[OpenSIPS-Users] dlg_val() is inconsistent

Răzvan Crainea razvan at opensips.org
Tue Aug 19 17:17:32 CEST 2014


Hi, Duane!

The only thing that has changed is that the $var(x) no longer returns 
"0" if it is not set, now it returns NULL. Therefore you should not 
check the var for "0" but for NULL:

if ( $var(x) != "0"

  should become:

if ( $var(x) != NULL


Best regards,

Răzvan Crainea
OpenSIPS Solutions
www.opensips-solutions.com

On 08/19/2014 04:36 AM, Duane Larson wrote:
> I was running version 1.9 and just upgraded to 1.11.2.  I was having 
> my issue on 1.9 and thought a newer version might fix my issue but it 
> is still occuring.
>
> I am using dlg_val to keep up with parked calls on Asterisk so that if 
> someone needs to retrieve a parked call the caller is relayed to the 
> correct Asterisk server that actually has the parked call.  For some 
> reason if someone first tries to retrieve a parked call it I see an 
> error of "no value in right expression" but if I call back a second 
> time the call is retrieved.  I am not sure why the dlg_val would not 
> have a value the first time but the second time it all of a sudden has 
> been populated.  Here is the syslog with xlog data and then I will 
> show my script.
>
>
>
> Caller = 9014XX6XX8
> Callee(Person parking call) = 9018X19XX4
> Call Park Initiate Number = *700
> Call Parked Number = *701
> New Caller Picking up call = 9018X19XX0
>
>
> Caller Calls Callee
> Aug 18 20:03:58 SIPProxy02 /usr/local/sbin/opensips[26074]: Dialog 
> Before: td [50.57.54.156], rU [9018X19XX4] fU [19014XX6XX8] HostVar 
> [<null>]
> Aug 18 20:03:58 SIPProxy02 /usr/local/sbin/opensips[26074]: About to 
> Route to Asterisk the From User Display name is the following fn [<null>]
> Aug 18 20:03:58 SIPProxy02 /usr/local/sbin/opensips[26074]: ToAsterisk 
> Route Before PSTN call IF check fU[19014XX6XX8] tU[9018X19XX4]
>
> Callee is parking call
> Aug 18 20:04:13 SIPProxy02 /usr/local/sbin/opensips[26077]: The Caller 
> is a Local customer fu - [sip:9018X19XX4 at launchyc.com 
> <mailto:sip%3A9018X19XX4 at launchyc.com>]
> Aug 18 20:04:13 SIPProxy02 /usr/local/sbin/opensips[26077]: Dialog 
> Before: td [launchyc.com <http://launchyc.com>], rU [*700] fU 
> [9018X19XX4] HostVar [<null>]
> Aug 18 20:04:13 SIPProxy02 /usr/local/sbin/opensips[26077]: Dialog 2: 
> 9018X19XX4 has another ongoing, on host sip:108.X.X.17
> Aug 18 20:04:13 SIPProxy02 /usr/local/sbin/opensips[26077]: ToAsterisk 
> Route Before PSTN call IF check fU[9018X19XX4] tU[*700]
>
>
> New Caller trying to pick up call at *701 and it fails
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: The Caller 
> is a Local customer fu - [sip:9018X19XX0 at launchyc.com 
> <mailto:sip%3A9018X19XX0 at launchyc.com>]
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: Dialog 
> Before: td [launchyc.com <http://launchyc.com>], rU [*701] fU 
> [9018X19XX0] HostVar [<null>]
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: Dialog 3: 
> 9018X19XX0 Retrieving Parked Call on host <null>
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: 
> ERROR:core:eval_elem: invalid string operands
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: 
> WARNING:core:do_assign: no value in right expression on line 2159
> Aug 18 20:04:40 SIPProxy02 /usr/local/sbin/opensips[26076]: ToAsterisk 
> Route Before PSTN call IF check fU[9018X19XX0] tU[*701]
>
> Second time trying to pick up parked call and everything works as it 
> should
> Aug 18 20:04:56 SIPProxy02 /usr/local/sbin/opensips[26077]: The Caller 
> is a Local customer fu - [sip:9018X19XX0 at launchyc.com 
> <mailto:sip%3A9018X19XX0 at launchyc.com>]
> Aug 18 20:04:56 SIPProxy02 /usr/local/sbin/opensips[26077]: Dialog 
> Before: td [launchyc.com <http://launchyc.com>], rU [*701] fU 
> [9018X19XX0] HostVar [sip:108.X.X.17]
> Aug 18 20:04:56 SIPProxy02 /usr/local/sbin/opensips[26077]: Dialog 3: 
> 9018X19XX0 Retrieving Parked Call on host sip:108.X.X.17
> Aug 18 20:04:56 SIPProxy02 /usr/local/sbin/opensips[26077]: ToAsterisk 
> Route Before PSTN call IF check fU[9018X19XX0] tU[*701]
>
>
>
> Script Section
>
>
>         ### - We need to see if someone in the domain parked a call
>         ### - If $var(x) doesn't equal 0 then our second ElseIf below 
> will be True
> get_dialog_info("host","$var(x)","parkedcall","$td");
>
>
> xlog("Dialog Before: td [$td], rU [$rU] fU [$fU] HostVar [$var(x)]\n");
>
>
>         ## -- This is required so that if a Customer wants to do an 
> Attended Transfer we send him to the
>         ## -- same Asterisk server his first call is already 
> terminated to.
>         ## -- We also make sure the number doesn't start with the 
> customers Voicemail number so that calls to voicemail don't always
>         ## -- get routed to the same Asterisk server
>         if ( get_dialog_info("host","$var(x)","caller","$fU") || 
> get_dialog_info("host","$var(x)","caller","$rU") && $rU !~ "^\*555") {
> xlog("Dialog 1: $fU has another ongoing, on host $var(x)\n");
>                 #route to host $var(x)
>                 $du = "sip:" + $rU + "@" + $(var(x){s.substr,4,0}) + 
> ":5060";
>
>                 ### - We need to keep up with Parked calls if the 
> attended transfer is to a *700 number
>                 if ( !match_dialog() )
>                 {
>                         create_dialog();
>                 }
>                 if($rU =~ "^\*7+"){
>                         ### -- Someone is parking a call
>                         $dlg_val(parkedcall) = $td;
>                 }
>                 $dlg_val(host) = $du;
>
>         } else if ( get_dialog_info("host","$var(x)","callee","$rU") 
> || get_dialog_info("host","$var(x)","callee","$fU") && $rU !~ "^\*555") {
>                 #route to host $var(x)
> xlog("Dialog 2: $fU has another ongoing, on host $var(x)\n");
>                 $du = "sip:" + $rU + "@" + $(var(x){s.substr,4,0}) + 
> ":5060";
>
>                 ### - We need to keep up with Parked calls if the 
> attended transfer is to a *700 number
>                 if ( !match_dialog() )
>                 {
>                         create_dialog();
>                 }
>                 if($rU =~ "^\*7+"){
>                         ### -- Someone is parking a call
>                         $dlg_val(parkedcall) = $td;
>                 }
>                 $dlg_val(host) = $du;
>
>         } else if ( $var(x) != "0" && $rU =~ "^\*7+") {
>                 ### -- Someone in domain X has parked a call and we 
> need to send this caller to the same Asterisk server so they can
>                 ### -- pick up the parked call
> xlog("Dialog 3: $fU Retrieving Parked Call on host $var(x)\n");
>                 $du = "sip:" + $rU + "@" + $(var(x){s.substr,4,0}) + 
> ":5060";
>
>         } else {
>
>                 if ( !match_dialog() )
>                 {
>                         create_dialog();
>                 }
>                 $dlg_val(caller) = $fU;
>                 $dlg_val(callee) = $rU;
>
>
>                 # Had to comment this out because of Asterisk bug. 
>  See statement below
>                 load_balance("100","sip");
>
>                 if ($retcode<0) {
>                         sl_send_reply("500","Service full");
>                         exit;
>                 }
>
>                 $dlg_val(host) = $du;
>
>                 # arm a failure route for be able to catch a failure 
> event and to do
>                 # failover to the next available destination
>
>                 ### - Set timeout to failover to other Load Balancer
>                 #$T_fr_inv_timeout = "5";
>                 $T_fr_timeout = 3;
>                 #$T_fr_timeout = "8";
>                 t_on_failure("LB_failed");
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140819/ba751186/attachment-0001.htm>


More information about the Users mailing list