Hi all,
I'd like to know if SER offers a way to register many phone numbers with just one REGISTER request. For example I've an IP gateway connected to the PBX and to the PSTN (for backup):
Phones-----> PBX--------> IP GW --------> PSTN Backup | | IP Backbone ------> SER
This PBX has a lot of phone numbers associated and a main phone number (receptionist for example). I would like to make this phone numbers registered on the proxy when the IP GW is running fine. But if the PBX has 100 numbers, the IP GW has to send 100 register requests to SER, moreover I'd like to register every 5-6 minutes so that the IP GW can use PSTN backup in case of failover of the WAN link. The problem is that I'm not sure that the IP GW will scale very well for a huge quantity of phone numbers (some customers have 700 phones numbers), and all these requests will consume bandwidth.
For the moment I've done a Perl Script running each time an IP GW register one number (the receptionist number for example) using the exec_dset function (exec_dset("/root/sip_registration.pl $SIP_HF_TO $SIP_SRCIP");).
This perl script looks into a database all the numbers related to the "receptionist" number and sends as many register information to the SER FIFO.
But I'm not very satisfied because I've to create (not yet implemented) as many temporary FIFO receipt as I receive "receptionist" register to maintain the relationship between a register request and the FIFO output (SER FIFO receipt). Moreover it's not easy to be sure that all the information passed to the FIFO have been correctly used (I'm for sure not a good programmer).
So I would like to know if there is a way in SER to do this (perhaps AVP ???) so I don't have to program a crappy perl script (see below for a first release of this perl script, if somebody know how I can create a temporary unix fifo in perl without using the system command: mkifo).
Thanks,
Rodrigue,
Here's my script:
#!/usr/bin/perl -w \
use DBI; use strict; use Fcntl;
#Database arguments
my $db = 'DBI:mysql:telephone:localhost'; my $username = 'root'; my $passwd = 'mo1000$$'; my $table = 'association';
#Error Log
my $error_log = "/var/log/sip_registration.log";
#SER FIFO arguments
my $fifo_method = "ul_add"; my $fifo_receipt = "ser_receipt_fifo"; my $fifo_table = "location"; my $fifo_expiration_timer = 60; my $fifo_qvalue = 0; my $fifo_replicate = 0; my $fifo_flags = 0;
#Get the uri and ip to register
my $uri = $ARGV[0]; my $ip = $ARGV[1];
#Get the phone number from the uri
my ($phone_number)= $uri =~ /sip:(.*)@/;
#Retrieve from database the numbers associated to the uri
my $dbh = DBI->connect($db, $username, $passwd); my $sql = qq{ SELECT associated FROM $table where initnumber='$phone_number' }; my $sth = $dbh->prepare($sql); $sth->execute;
#Bulk registration using FIFO
open(my $wr,">", "/tmp/ser_fifo");
select((select($wr), $|=1)[0]);
sysopen(my $read, "/tmp/$fifo_receipt", O_RDONLY | O_NONBLOCK); my $i=1;
my $associated_phone; $sth->bind_col(1,$associated_phone); while($sth->fetch()) { if ($associated_phone != $phone_number) { print $wr ":$fifo_method:$fifo_receipt\n$fifo_table\n$associated_phone\nsip:$associate d_phone@$ip\n$fifo_expiration_timer\ n$fifo_qvalue\n$fifo_replicate\n$fifo_flags\n" or die; my @read_fifo; while(<$read>){ $read_fifo[0]=$_; #print "$i $read_fifo[0]";
} $i++; } } #print "ASSOCIATED PHONE : $associated_phone"; # Wait till the loop see the last associated phone, the receipt FIFO has to #be completely synchronised between Input (SER FIFO) and Ouput (Temporary #receipt FIFO) , not sure that SER works in this way.
while(<$read> !~ /sip:$associated_phone@$ip/){ #DO NOTHING
} close($read); close($wr);
$sth->finish(); $dbh->disconnect();
#Return uri to STDOUT to be compliant with SER exec_dset function
print "$uri";
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
hi,
before t_relay(); call a failure_route.
in the failure_route do something like this..
failure_route(x){
if(t_check_status(486)){ rewritehostport("some.where:5060"); t_relay(); }; };
* Olivier Taylor olivier.taylor@gmail.com [050912 13:50]:
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Hi
I have a single SER wiht some clients and a PSTN gateway. Forwarding calls over the internet to other SIP proxies is not possible/allowed. Now i wonder, if i could compare the mf_process_maxfwd_header() with 1 since - if i understand that concept right - there will always only be one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Hello,
depending on what version of proxy do you have, you can use avpops (write the value of the maxfwd header in an avp and then compare). See: http://www.voice-system.ro/docs/avpops/
Daniel
On 09/12/05 15:38, Frank Fischer wrote:
Hi
I have a single SER wiht some clients and a PSTN gateway. Forwarding calls over the internet to other SIP proxies is not possible/allowed. Now i wonder, if i could compare the mf_process_maxfwd_header() with 1 since - if i understand that concept right - there will always only be one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Hi Daniel
Thanks for your answer. But i don't undestand why i would need the avp module to do that - couldn't i just set something like
if (!mf_process_maxfwd_header("1")) { ... };
As far as i understood, the mf_process_maxfwd_header() method compairs the given value (i.e. 1) to theactual value in the request? So my question is, in my setup with only one SER Proxy with some UAs and a PSTN Gateway and no forwaring or receiving from other SIP Proxies, would it make sense to set there parameter for max_hops to 1 or am I missing something and this might cause probles?
Greetings Frank
-----Ursprüngliche Nachricht----- Von: Daniel-Constantin Mierla [mailto:daniel@voice-system.ro] Gesendet: Montag, 12. September 2005 18:14 An: Frank Fischer Cc: serusers@lists.iptel.org Betreff: Re: [Serusers] Setting maxfwd to 1 in single SER env?
Hello,
depending on what version of proxy do you have, you can use avpops (write the value of the maxfwd header in an avp and then compare). See: http://www.voice-system.ro/docs/avpops/
Daniel
On 09/12/05 15:38, Frank Fischer wrote:
Hi
I have a single SER wiht some clients and a PSTN gateway. Forwarding calls over the internet to other SIP proxies is not
possible/allowed.
Now i wonder, if i could compare the
mf_process_maxfwd_header() with 1
since - if i understand that concept right - there will
always only be
one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Frank Fischer wrote:
Hi Daniel
Thanks for your answer. But i don't undestand why i would need the avp module to do that - couldn't i just set something like
max_fwd will be counted down to zero, starting with value set by the UAC. Thus, you would have to guess the first value, and check for value-1
Why can't you block access based on the domain in the sip URIs?
regards klaus
if (!mf_process_maxfwd_header("1")) { ... };
As far as i understood, the mf_process_maxfwd_header() method compairs the given value (i.e. 1) to theactual value in the request? So my question is, in my setup with only one SER Proxy with some UAs and a PSTN Gateway and no forwaring or receiving from other SIP Proxies, would it make sense to set there parameter for max_hops to 1 or am I missing something and this might cause probles?
Greetings Frank
-----Ursprüngliche Nachricht----- Von: Daniel-Constantin Mierla [mailto:daniel@voice-system.ro] Gesendet: Montag, 12. September 2005 18:14 An: Frank Fischer Cc: serusers@lists.iptel.org Betreff: Re: [Serusers] Setting maxfwd to 1 in single SER env?
Hello,
depending on what version of proxy do you have, you can use avpops (write the value of the maxfwd header in an avp and then compare). See: http://www.voice-system.ro/docs/avpops/
Daniel
On 09/12/05 15:38, Frank Fischer wrote:
Hi
I have a single SER wiht some clients and a PSTN gateway. Forwarding calls over the internet to other SIP proxies is not
possible/allowed.
Now i wonder, if i could compare the
mf_process_maxfwd_header() with 1
since - if i understand that concept right - there will
always only be
one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
On 09/12/05 22:41, Frank Fischer wrote:
Hi Daniel
Thanks for your answer. But i don't undestand why i would need the avp module to do that - couldn't i just set something like
if (!mf_process_maxfwd_header("1")) { ... };
As far as i understood, the mf_process_maxfwd_header() method compairs the given value (i.e. 1) to theactual value in the request?
No, please see the readme file of the module. It adds a maxfwd header with the value given as parameter, if there is no maxfwd header. If the header already exists, it compares the value decremented with one against 0.
So my question is, in my setup with only one SER Proxy with some UAs and a PSTN Gateway and no forwaring or receiving from other SIP Proxies, would it make sense to set there parameter for max_hops to 1 or am I missing something and this might cause probles?
Be sure you do not do local loops. Otherwise, besides doing extra processing (remove+add header) to change the value of maxfwd to 1, there should not be any harm.
Daniel
Greetings Frank
-----Ursprüngliche Nachricht----- Von: Daniel-Constantin Mierla [mailto:daniel@voice-system.ro] Gesendet: Montag, 12. September 2005 18:14 An: Frank Fischer Cc: serusers@lists.iptel.org Betreff: Re: [Serusers] Setting maxfwd to 1 in single SER env?
Hello,
depending on what version of proxy do you have, you can use avpops (write the value of the maxfwd header in an avp and then compare). See: http://www.voice-system.ro/docs/avpops/
Daniel
On 09/12/05 15:38, Frank Fischer wrote:
Hi
I have a single SER wiht some clients and a PSTN gateway. Forwarding calls over the internet to other SIP proxies is not
possible/allowed.
Now i wonder, if i could compare the
mf_process_maxfwd_header() with 1
since - if i understand that concept right - there will
always only be
one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Except the case that UA may want to forward request to other proxy or call controller (e.g. voicemail) from its end. An example would be a UA activate DND and forward all requests to voicemail server within its administrative domain. It will not be able to do so. If it is your policy to disallow this type of communication, then yes, you have the logic.
I don't see why you need such control. Max forward is usually used for loop detection.
Zeus
-----Original Message----- From: serusers-bounces@lists.iptel.org On Behalf Of Frank Fischer Sent: Tuesday, 13 September 2005 5:42 AM To: serusers@lists.iptel.org Subject: AW: [Serusers] Setting maxfwd to 1 in single SER env?
Hi Daniel
Thanks for your answer. But i don't undestand why i would need the avp module to do that - couldn't i just set something like
if (!mf_process_maxfwd_header("1")) { ... };
As far as i understood, the mf_process_maxfwd_header() method compairs the given value (i.e. 1) to theactual value in the request? So my question is, in my setup with only one SER Proxy with some UAs and a PSTN Gateway and no forwaring or receiving from other SIP Proxies, would it make sense to set there parameter for max_hops to 1 or am I missing something and this might cause probles?
Greetings Frank
-----Ursprüngliche Nachricht----- Von: Daniel-Constantin Mierla [mailto:daniel@voice-system.ro] Gesendet: Montag, 12. September 2005 18:14 An: Frank Fischer Cc: serusers@lists.iptel.org Betreff: Re: [Serusers] Setting maxfwd to 1 in single SER env?
Hello,
depending on what version of proxy do you have, you can use avpops (write the value of the maxfwd header in an avp and then compare). See: http://www.voice-system.ro/docs/avpops/
Daniel
On 09/12/05 15:38, Frank Fischer wrote:
Hi
I have a single SER wiht some clients and a PSTN gateway.
Forwarding
calls over the internet to other SIP proxies is not
possible/allowed.
Now i wonder, if i could compare the
mf_process_maxfwd_header() with 1
since - if i understand that concept right - there will
always only be
one hop needed (eihter client to client or client to pstn gateway).
Do i get this right or am i missing anything important?
Greetings Frank
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
Oliver,
In the failure route you can add some conditional logic like this:
... } else if (t_check_status("408")) { xlog("L_ERR", " Failure Route 1 - 408 no answer detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; } else if (t_check_status("486")) { xlog("L_ERR", " Failure Route 1 - 486 busy detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; ...
The other popular one is unconditional forwarding. If you're going to use that one you're going to have to do it before anything else.
I'd also do something like this in your main route: if (!lookup("location")) {
if (does_uri_exist()) { xlog("L_ERR", " Unregistered UA found. Diverting to VM.\n"); # Rewrite to voicemail or wherever route(3); break; };
This will catch offline UAs.
Those are the basics.
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
This message has been scanned for viruses and dangerous content, and is believed to be clean.
********************************************* This message has been scanned for viruses and dangerous content, and is believed to be clean.
What about this mysterious route(3) you mention ;)?
And I suppose that "# Whatever destination rewrite here" can be an "avp_pushto("$ruri/username", "s:callee_3");" for example..
Thanks, Olivier
-----Message d'origine----- De : Corey S. McFadden [mailto:csm-lists@csma.biz] Envoyé : lundi 12 septembre 2005 18:17 À : Olivier Taylor Cc : serusers@lists.iptel.org Objet : Re: [Serusers] Conditional forwarding
Oliver,
In the failure route you can add some conditional logic like this:
... } else if (t_check_status("408")) { xlog("L_ERR", " Failure Route 1 - 408 no answer detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; } else if (t_check_status("486")) { xlog("L_ERR", " Failure Route 1 - 486 busy detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; ...
The other popular one is unconditional forwarding. If you're going to use that one you're going to have to do it before anything else.
I'd also do something like this in your main route: if (!lookup("location")) {
if (does_uri_exist()) { xlog("L_ERR", " Unregistered UA found. Diverting to VM.\n"); # Rewrite to voicemail or wherever route(3); break; };
This will catch offline UAs.
Those are the basics.
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
This message has been scanned for viruses and dangerous content, and is believed to be clean.
********************************************* This message has been scanned for viruses and dangerous content, and is believed to be clean.
Oliver,
I don't know much about AVPOps yet, but as long as that rewrites the URI you should be ok.
For our voicemail we actually just rewrite the host part of the URI to an Asterisk server. The asterisk context takes care of the rest. But you could od whatever you want there.
As far as our route[3], I'm guessing you're kidding but it's much like the ONSip.org example and routes to different gateways... (You could always just t_relay it!)
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
What about this mysterious route(3) you mention ;)?
And I suppose that "# Whatever destination rewrite here" can be an "avp_pushto("$ruri/username", "s:callee_3");" for example..
Thanks, Olivier
-----Message d'origine----- De : Corey S. McFadden [mailto:csm-lists@csma.biz] Envoyé : lundi 12 septembre 2005 18:17 À : Olivier Taylor Cc : serusers@lists.iptel.org Objet : Re: [Serusers] Conditional forwarding
Oliver,
In the failure route you can add some conditional logic like this:
... } else if (t_check_status("408")) { xlog("L_ERR", " Failure Route 1 - 408 no answer detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; } else if (t_check_status("486")) { xlog("L_ERR", " Failure Route 1 - 486 busy detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; ...
The other popular one is unconditional forwarding. If you're going to use that one you're going to have to do it before anything else.
I'd also do something like this in your main route: if (!lookup("location")) {
if (does_uri_exist()) { xlog("L_ERR", " Unregistered UA found. Diverting to
VM.\n"); # Rewrite to voicemail or wherever route(3); break; };
This will catch offline UAs.
Those are the basics.
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
This message has been scanned for viruses and dangerous content, and is believed to be clean.
This message has been scanned for viruses and dangerous content, and is believed to be clean.
This message has been scanned for viruses and dangerous content, and is believed to be clean.
********************************************* This message has been scanned for viruses and dangerous content, and is believed to be clean.
Thanks Corey, I will try that.
Olivier
-----Message d'origine----- De : Corey S. McFadden [mailto:csm-lists@csma.biz] Envoyé : lundi 12 septembre 2005 20:45 À : Olivier Taylor Cc : serusers@lists.iptel.org Objet : Re: RE : [Serusers] Conditional forwarding
Oliver,
I don't know much about AVPOps yet, but as long as that rewrites the URI you should be ok.
For our voicemail we actually just rewrite the host part of the URI to an Asterisk server. The asterisk context takes care of the rest. But you could od whatever you want there.
As far as our route[3], I'm guessing you're kidding but it's much like the ONSip.org example and routes to different gateways... (You could always just t_relay it!)
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
What about this mysterious route(3) you mention ;)?
And I suppose that "# Whatever destination rewrite here" can be an "avp_pushto("$ruri/username", "s:callee_3");" for example..
Thanks, Olivier
-----Message d'origine----- De : Corey S. McFadden [mailto:csm-lists@csma.biz] Envoyé : lundi 12 septembre 2005 18:17 À : Olivier Taylor Cc : serusers@lists.iptel.org Objet : Re: [Serusers] Conditional forwarding
Oliver,
In the failure route you can add some conditional logic like this:
... } else if (t_check_status("408")) { xlog("L_ERR", " Failure Route 1 - 408 no answer detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; } else if (t_check_status("486")) { xlog("L_ERR", " Failure Route 1 - 486 busy detected.\n"); # Whatever destination rewrite here append_branch(); route(3); break; ...
The other popular one is unconditional forwarding. If you're going to use that one you're going to have to do it before anything else.
I'd also do something like this in your main route: if (!lookup("location")) {
if (does_uri_exist()) { xlog("L_ERR", " Unregistered UA found. Diverting to
VM.\n"); # Rewrite to voicemail or wherever route(3); break; };
This will catch offline UAs.
Those are the basics.
-Corey
On Mon, 12 Sep 2005, Olivier Taylor wrote:
Hi all,
Does any of you can give me the ser.cfg part for a call forwarding when busy or no response?
My code works for unconditional forwarding.
Thx,
Olivier
Serusers mailing list serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
This message has been scanned for viruses and dangerous content, and is believed to be clean.
This message has been scanned for viruses and dangerous content, and is believed to be clean.
This message has been scanned for viruses and dangerous content, and is believed to be clean.
********************************************* This message has been scanned for viruses and dangerous content, and is believed to be clean.