[Serusers] Help when make a Call Busy Forward Failed? Does 'bestpractice' release??

Greger V. Teigre greger at teigre.com
Thu Feb 24 08:19:00 CET 2005


Charles,
IMHO, you should call t_on_failure for all failures and then do matching on 
status codes there. So, remove the if(isflagset(31)) .  Remember that the 
flag can only be set in ser.cfg using setflag(31);  If you want to map a 
usr_preferences setting like "n" to setting a flag or not, you need to 
avp_db_load() the avp (here:voicemail) and then do an if(avp_check(="y")) 
then setflag(31).  This is like I showed in a previous email.
g-)

Charles Wang wrote:
> Dear Greger:
>
> I have no voicemail service in my scenario. So I keep the voicemail
> flag and I setting it as "n" in usr_preferences table.
>
> And where to add these code of your support? Please show me a example.
> Thank you very much.
>
> Best Regard
> Charles.
>
>
> On Thu, 24 Feb 2005 07:53:06 +0100, Greger V. Teigre
> <greger at teigre.com> wrote:
>> Without following all your logic below, a quick question: You wrap
>> the setting of t_on_failure based on flag 31.  Is that the only
>> situation where you want failure route to be called?
>>
>> if (isflagset(31)) {  # is voice mail?
>> t_on_failure("1");
>> };
>>
>> g-)
>>
>> Charles Wang wrote:
>>> Dear ALL:
>>>
>>> I use Paul's ser.cfg for 0.9.0 post last year and wanna implement a
>>> call busy forward.
>>> I think Paul is busy on testing 'Best Practice', so he doesn't
>>> answer too much mail.
>>>
>>> I try to make a call from UA1 to UA2, and UA2 is busy.
>>> So the call will forward to another Trunk 3.
>>> Ex: UA1 ==> UA2(busy) ==(failure_route[1])==> Trunk 3
>>>
>>> PS: UA1 and UA2 behind different NATs.
>>>
>>>
>>> But when I watch the log, I find that miss the following log
>>> (diff with call from UA1 to UA2 and directly forward to Trunk 3
>>> Ex: UA1 ==> UA2(callfwd) ==> Trunk 3
>>>
>>> When I make a callfwd call, the call will run route[3] but not
>>> failure_route[1]. UA1==>UA2(callfwd)==>route[2]==>Trunk 3
>>>
>>> route[2]  ====> SIP to SIP call
>>> route[3]  ====> SIP to PSTN call
>>> failure_route[1] ====> NoAnswer or Busy Forward logic
>>>
>>> And I make a fwdbusy call, the call will run route[2] then go to
>>> failure_route[1], and return to route[3].
>>> UA1==>UA2(fwdbusy)==>failure_route[1]==>route[3] =XXX=> Trunk 3 ????
>>>
>>> Why does the method be failed? Do I must "end_media_session()"
>>> before start a busy call?
>>> How can I modify it?
>>>
>>>
>>> My snippet ser.cfg :
>>> --------------------------------------------------------------------------------------------------------------
>>> route[3] {
>>> log(1, "SER: International Call Off-Net section route(3)\n");
>>>
>>> # All Domestic Calls Go To CISCO
>>> if (method=="INVITE") {
>>> if (!proxy_authorize("", "subscriber")) {
>>> proxy_challenge("", "0");
>>> break;
>>> } else if (!check_from()) {
>>> log(1, "Spoofed SIP call attempt");
>>> sl_send_reply("403", "Use From=ID");
>>> break;
>>> } else if (!(is_from_local() || is_uri_host_local())) {
>>> sl_send_reply("403", "Please register to use our service");
>>> break;
>>> };
>>> # enable caller id blocking for PSTN calls
>>> if (isflagset(25)) {
>>> append_rpid_hf();
>>> };
>>> };
>>> # SIP->PSTN calls get 45 seconds to timeout
>>> log(1, "SER: Connecting to PSTN.....\n");
>>> avp_write("i:45", "inv_timeout");
>>>
>>> rewritehost("xxx.xxx.190.243");           #### A Trunking Gateway
>>>
>>> if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
>>> !search("^Route:")){
>>> sl_send_reply("479", "We don't forward to private IP addresses");
>>> break;
>>> };
>>> if (method=="INVITE" || method=="ACK") {
>>> use_media_proxy();
>>> };
>>> if (isflagset(31)) {  # is voice mail?
>>> t_on_failure("1");
>>> };
>>> t_on_reply("1");
>>> if (!t_relay()) {
>>> if (method=="INVITE" || method=="ACK") {
>>> end_media_session();
>>> };
>>> sl_reply_error();
>>> };
>>> }
>>> failure_route[1] {
>>>      log(1, "SER: Failure Route section failure_route(1)\n");
>>>
>>>      # if caller hung up then don't sent to voicemail
>>>      if (t_check_status("487")) {
>>>              break;
>>>      };
>>>      if (isflagset(26) && t_check_status("486")) {
>>>              # forward busy is flag 26
>>>
>>>              if (avp_pushto("$ruri", "s:fwdbusy")) {
>>>                      log(1, "SER: fork to fwdbusy\n");
>>>                      avp_delete("s:fwdbusy");
>>>                      append_branch();
>>>                      resetflag(26);
>>>
>>>                      # test for domestic PSTN gateway
>>>                      if (uri=~"^sip:0[0-9]{9}@") {
>>>                      # if (avp_check("$fwd_busy_type", "eq/dom/i"))
>>>                              { # test for domestic PSTN gateway
>>>                              log(1, "SER: Busy Failure and Jump to
>>> route(3)\n");
>>>                              route(3);
>>>                      } else if (uri=~"^sip:002[1-9][0-9]*@") {
>>>                      # } else if (avp_check("$fwd_busy_type",
>>>                              "eq/int/i")) { # test for international
>>>                              PSTN gateway log(1, "SER: Busy Failure
>>> and Jump to
>>> route(6)\n");
>>>                              route(6);
>>>                      } else {
>>>                              # default to sip call
>>>                              log(1, "SER: Busy Failure and Jump to
>>> route(2)\n");
>>>                              route(2);
>>>                      };
>>>                      break;
>>>              };
>>>      };
>>>
>>>      # here we can have either voicemail __OR__ forward no answer
>>>      if (isflagset(27) && t_check_status("408")) {
>>>              # forward no answer is flag 27
>>>
>>>              if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
>>>                      avp_pushto("$ruri", "s:fwdnoanswer");
>>>                      log(1, "SER: fork to fwdnoanswer\n");
>>>                      avp_delete("s:fwdnoanswer");
>>>                      append_branch();
>>>                      resetflag(27);
>>>
>>>                      if (uri=~"^sip:0[0-9]{9}@") {
>>>                      # if (avp_check("$fwd_no_answer_type",
>>>                              "eq/dom/i")) { # test for domestic PSTN
>>>                              gateway log(1, "SER: No Answer Failure
>>> and Jump
>>> to route(3)\n");
>>>                              route(3);
>>>                } else if (uri=~"^sip:002[1-9][0-9]*@") {
>>>                      # } else if (avp_check("$fwd_no_answer_type",
>>> "eq/int/i")) {
>>>                              # test for international PSTN gateway
>>>                              log(1, "SER: No Answer Failure and Jump
>>> to route(6)\n");
>>>                              route(6);
>>>                      } else {
>>>                              # default to sip call
>>>                              log(1, "SER: No Answer Failure and Jump
>>> to route(2)\n");
>>>                              route(2);
>>>                      };
>>>                      break;
>>>              };
>>>      } else if (isflagset(31) && avp_pushto("$ruri", "$voicemail"))
>>>              { avp_delete("$voicemail");
>>>              log(1, "SER: No Answer Failure and Jump to
>>>              route(4)\n"); route(4);
>>>              break;
>>>      };
>>> }
>>>
>>>
>>> In SysLog:
>>> ------------------------------------------------------------------------------------------------------
>>> proxydispatcher[13265]: command request
>>> 06DC9503-1938-4D9D-8628-E648F112BEC5 at 192.168.11.7
>>> 192.168.11.7:8000:audio 61.217.225.225 ser.xxx.net.tw local
>>> xxx.xxx.190.243 remote X-PRO=20build=201082
>>> info=from:1011 at ser.xxx.net.tw,to:9012 at ser.xxx.net.tw,fromtag:2069977709,totag:
>>> Feb 24 00:59:21 ser proxydispatcher[13265]: domain ser.xxx.net.tw
>>> doesn't define any mediaproxy.
>>> Feb 24 00:59:21 ser proxydispatcher[13265]: will use default
>>> mediaproxy for this call.
>>> Feb 24 00:59:21 ser mediaproxy[1087]: command request
>>> 06DC9503-1938-4D9D-8628-E648F112BEC5 at 192.168.11.7
>>> 192.168.11.7:8000:audio 61.217.225.225 ser.xxx.net.tw local
>>> xxx.xxx.190.243 remote X-PRO=20build=201082
>>> info=from:1011 at ser.xxx.net.tw,to:9012 at ser.xxx.net.tw,fromtag:2069977709,totag:,dispatcher
>>> Feb 24 00:59:21 ser mediaproxy[1087]: command execution time:  0.35
>>> ms Feb 24 00:59:21 ser proxydispatcher[13265]: forwarding to
>>> mediaproxy on /var/run/mediaproxy.sock: got: 'xxx.xxx.190.248 35030'
>>> Feb 24 00:59:21 ser proxydispatcher[13265]: command execution time:
>>> 311.69 ms
>>>
>>> _______________________________________________
>>> Serusers mailing list
>>> serusers at lists.iptel.org
>>> http://lists.iptel.org/mailman/listinfo/serusers 




More information about the sr-users mailing list