Dialplan module problems

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Dialplan module problems

Brett Nemeroff
Hey All,
I'm using the dialplan module and trying to use an avp for the dpid.. avp_print shows my avp like this:
Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp: p=0xb620c0f8, flags=0x0003 
Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp:                         name=<trunkid> 
Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp:                         val_str=<3 / 1> 

And I'm calling this:
        dp_translate("$avp(s:trunkid)","$ruri.user/$avp(s:trans_uri)");

And it keeps giving this error:
Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]: ERROR:dialplan:dp_get_ivalue: no AVP or SCRIPTVAR found (error in scripts) 
Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]: ERROR:dialplan:dp_translate_f: no dpid value 

It's almost like it doesn't like the string value.. but for the life of me, I can't figure out how to get it to return an integer value.. But I'm not even sure this is the case..

Any ideas?

BTW, if I staticly stick that number "3" into the dpid field, it works *perfectly*

Thanks,
Brett




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dialplan module problems

Bogdan-Andrei Iancu
Hi Brett,

I think you set the value of the AVP as string, while the module do
expect an integer value (the DP id).

Regards,
Bogdan

Brett Nemeroff wrote:

> Hey All,
> I'm using the dialplan module and trying to use an avp for the dpid..
> avp_print shows my avp like this:
> Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]:
> INFO:avpops:ops_print_avp: p=0xb620c0f8, flags=0x0003
> Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]:
> INFO:avpops:ops_print_avp:                         name=<trunkid>
> Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]:
> INFO:avpops:ops_print_avp:                         val_str=<3 / 1>
>
> And I'm calling this:
>         dp_translate("$avp(s:trunkid)","$ruri.user/$avp(s:trans_uri)");
>
> And it keeps giving this error:
> Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]:
> ERROR:dialplan:dp_get_ivalue: no AVP or SCRIPTVAR found (error in
> scripts)
> Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]:
> ERROR:dialplan:dp_translate_f: no dpid value
>
> It's almost like it doesn't like the string value.. but for the life
> of me, I can't figure out how to get it to return an integer value..
> But I'm not even sure this is the case..
>
> Any ideas?
>
> BTW, if I staticly stick that number "3" into the dpid field, it works
> *perfectly*
>
> Thanks,
> Brett
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>  


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dialplan module problems

Brett Nemeroff
Hey Bogdan,
you know, for the life of me, I couldn't get it to be an int. Even in my select, I cast the result to an INT.

Well, you know, I had the exact same problem with memcache (store an INT, but retrieved it's a STR) and I fixed that with:
$(avp(s:my_string_number){s.int})

So I did the same with this var, and it seems to be working great now. Whew!

I'm curious, how do you cast the other way? INT to STR? Haven't needed it yet, but surely it'll come up.

BTW, I really like this dialplan module. I'd love to see your JSON idea adapted into that as well. How far out do you think that is? I've got uses for it now. I think it's a great idea. Id' stick it on all the modules. :)


-Brett


 

On Fri, May 1, 2009 at 6:44 AM, Bogdan-Andrei Iancu <[hidden email]> wrote:
Hi Brett,

I think you set the value of the AVP as string, while the module do expect an integer value (the DP id).

Regards,
Bogdan

Brett Nemeroff wrote:
Hey All,
I'm using the dialplan module and trying to use an avp for the dpid.. avp_print shows my avp like this:
Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp: p=0xb620c0f8, flags=0x0003 Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp:                         name=<trunkid> Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp:                         val_str=<3 / 1>
And I'm calling this:
       dp_translate("$avp(s:trunkid)","$ruri.user/$avp(s:trans_uri)");

And it keeps giving this error:
Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]: ERROR:dialplan:dp_get_ivalue: no AVP or SCRIPTVAR found (error in scripts) Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]: ERROR:dialplan:dp_translate_f: no dpid value
It's almost like it doesn't like the string value.. but for the life of me, I can't figure out how to get it to return an integer value.. But I'm not even sure this is the case..

Any ideas?

BTW, if I staticly stick that number "3" into the dpid field, it works *perfectly*

Thanks,
Brett



------------------------------------------------------------------------

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
 



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Dialplan module problems

Bogdan-Andrei Iancu
Hi Brett,

Brett Nemeroff wrote:
> Hey Bogdan,
> you know, for the life of me, I couldn't get it to be an int. Even in
> my select, I cast the result to an INT.
you mean you load this ID from DB where it is an INT field and you get a
STR val AVP?
>
> Well, you know, I had the exact same problem with memcache (store an
> INT, but retrieved it's a STR) and I fixed that with:
> $(avp(s:my_string_number){s.int <http://s.int>})
>
> So I did the same with this var, and it seems to be working great now.
> Whew!
OK, works :)
>
> I'm curious, how do you cast the other way? INT to STR? Haven't needed
> it yet, but surely it'll come up.
an assignment will to the trick: $avp(str) = ""+$avp(no);
>
> BTW, I really like this dialplan module. I'd love to see your JSON
> idea adapted into that as well. How far out do you think that is? I've
> got uses for it now. I think it's a great idea. Id' stick it on all
> the modules. :)
right now we investigate what are the available Json libs for C and how
suitable are for opensips. Otherwise we have to write one :)

Regards,
Bogdan

>
>
> -Brett
>
>
>  
>
> On Fri, May 1, 2009 at 6:44 AM, Bogdan-Andrei Iancu
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Hi Brett,
>
>     I think you set the value of the AVP as string, while the module
>     do expect an integer value (the DP id).
>
>     Regards,
>     Bogdan
>
>     Brett Nemeroff wrote:
>
>         Hey All,
>         I'm using the dialplan module and trying to use an avp for the
>         dpid.. avp_print shows my avp like this:
>         Apr 30 21:48:26 sip1 /usr/local/sbin/opensips[8079]:
>         INFO:avpops:ops_print_avp: p=0xb620c0f8, flags=0x0003 Apr 30
>         21:48:26 sip1 /usr/local/sbin/opensips[8079]:
>         INFO:avpops:ops_print_avp:                        
>         name=<trunkid> Apr 30 21:48:26 sip1
>         /usr/local/sbin/opensips[8079]: INFO:avpops:ops_print_avp:    
>                             val_str=<3 / 1>
>         And I'm calling this:
>              
>          dp_translate("$avp(s:trunkid)","$ruri.user/$avp(s:trans_uri)");
>
>         And it keeps giving this error:
>         Apr 30 21:49:15 sip1 /usr/local/sbin/opensips[8090]:
>         ERROR:dialplan:dp_get_ivalue: no AVP or SCRIPTVAR found (error
>         in scripts) Apr 30 21:49:15 sip1
>         /usr/local/sbin/opensips[8090]: ERROR:dialplan:dp_translate_f:
>         no dpid value
>         It's almost like it doesn't like the string value.. but for
>         the life of me, I can't figure out how to get it to return an
>         integer value.. But I'm not even sure this is the case..
>
>         Any ideas?
>
>         BTW, if I staticly stick that number "3" into the dpid field,
>         it works *perfectly*
>
>         Thanks,
>         Brett
>
>
>
>         ------------------------------------------------------------------------
>
>         _______________________________________________
>         Users mailing list
>         [hidden email] <mailto:[hidden email]>
>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>          
>
>
>


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users