[OpenSIPS-Users] RES: exec_dset / mySQL / SER

AsteriskGuide flavio at asteriskguide.com
Wed Feb 24 22:18:42 CET 2010


As simple as possible is usually the best way. 

 

$ru=avp(i:1); 

 

Is ok. 

 

Flavio E. Goncalves

 

De: users-bounces at lists.opensips.org
[mailto:users-bounces at lists.opensips.org] Em nome de Phillip Jones
Enviada em: Wednesday, February 24, 2010 5:49 PM
Para: OpenSIPS users mailling list
Assunto: Re: [OpenSIPS-Users] exec_dset / mySQL / SER

 

Thank you both for that help.

I have gone ahead and successfully implemented the avp_db_query version and
I now have a variable  $avp(i:1) that contains the correct forwarding uri.

Now this is really where I show my ignorance.

How go I use $avp(i:1) correctly, considering that I am going to call
t_relay()

if (!t_relay()) 
    { 
              sl_reply_error();
    };

Is it simply a case of $ru =  $avp(i:1);

That appears to work but I just want to make sure it is the correct
approach.

Thanks again

pj




On Wed, Feb 24, 2010 at 2:25 PM, Brett Nemeroff <brett at nemeroff.com> wrote:

Something else I wanted to mention regarding your code here.. There is an
obvious race condition if two calls come in at once.. your script writes the
query results to a tmp file which could already be written by another call.

 

Overall, exec_dset should be avoided IMO. avp_db_query is fast, and easy to
implement. I think you'll be happy with the results. The conversion should
be simple enough, especially if your shell script really is that simple..

 

-Brett

 

 

 

On Wed, Feb 24, 2010 at 12:44 PM, Phillip Jones <pjintheusa at gmail.com>
wrote:

Hi there,

I am new to opensips - and I am trying to convert a script currently working
in SER. I am almost done - but have one last issue that is getting the
better of me. This is the script part:

exec_dset('
                
                AQUERY="CALL Routing(\"$$SIP_USER\", \"$$SIP_SRCIP\",
\"$$SIP_RURI\", \"$$SIP_ORURI\", False);";
                AURI=`mysql -Broot -pxxxxxxx -e "$$AQUERY" opensips`;

                echo $$AQUERY > /tmp/AQUERY.txt
                echo $$AURI> /tmp/AURI.txt

                if [ ! -z "$$AURI" ] ; then
                        
                    printf ("$$AURI");            
                fi;
                
                exit;
        
                echo > dev/null
        
            ');

AURI contains "+-----------------------------------+ | DestinationURI |
+-----------------------------------+ | sip:121255555666 at 64.55.55.555:5060 |
+-----------------------------------+" which kind of makes sense.

Opensips falls over with error: ERROR:core:parse_uri: bad uri - which also
makes sense.

If I use printf ("sip:121255555666 at 64.55.55.555:5060"); then every thing
works nicely.

What I am missing here? If this worked in SER - what has changed - a config
in MySQL??

Any help would be much appreciated. I think I could use REGEX here to
extract the uri, but I not familiar with the syntax in opensips.



Thanks


pj

_______________________________________________
Users mailing list
Users at lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

 


_______________________________________________
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/20100224/90e271f4/attachment.htm 


More information about the Users mailing list