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

AsteriskGuide flavio at asteriskguide.com
Wed Feb 24 20:12:06 CET 2010


Hi, 

 

It seems to me that you are simply running a call procedure in the database
and sending the query and uri to a txt file.  You may call the stored
procedure in the database using avp_db_query, check the syntax in the
documentation. Instead of using echo, you may use xlog to send these queries
to a log file instead of simply overwrite AQUERY.txt and AURI.txt. Native
commands are faster than calling an external shell and are more reliable. 

 

$$SIP_USER  - $rU

$$SIP_SRCIP - $si

$$SIP_RURI - $ru

$$SIP_ORURI - $tu - original ruri (my best guess)

 

If !(avp_db_query("call routing('$rU, $si, $ru, $tu, False'))) {

    xlog("query failed, $rU, $si, $ru, $tu, False");

}

 

I have already used avp_db_query to call a stored procedure so works and is
much faster then exec_dset. 

 

I hope it helps, 

 

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 3:44 PM
Para: Users at lists.opensips.org
Assunto: [OpenSIPS-Users] exec_dset / mySQL / SER

 

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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100224/c30ec57a/attachment.htm 


More information about the Users mailing list