[Users] t_relay() to a destination set by dispatcher
Daniel-Constantin Mierla
daniel at voice-system.ro
Wed Jul 12 18:22:28 CEST 2006
Hello,
On 07/11/06 23:49, Radu Maierean wrote:
> hi all,
>
> i need to use the dispatcher module to route (load-balanced) an incoming
> SIP request to one of my bunch of asterisk machines. openser (1.1.0, the
> only one that implements the dispatcher as i need it) is also supposed
> to translate from TCP (the protocol that my peer gateway uses) to UDP
> (the only protocol that asterisk knows - snip).
>
> my attempt was this:
>
> # routing INVITE and CANCEL messages received from the gateway to
> Asterisk
> if (uri=~"^sip:\+1[0-9]+ at xx\.xx\.xx\.xx") {
> t_on_failure("2");
> if ((method=="INVITE") || (method=="CANCEL")) {
> ds_select_dst("1", "0");
> t_relay("udp:$dd:5061");
> return;
> }
> }
>
> note that t_relay() must change the protocol type and set a non-default
> port number. the problem is that the $dd pseudovariable in t_relay() is
> not parsed, i actually get an error at openser startup:
>
t_relay("dst") does not support pseudo-variables - it compiles the
destination address (dns, ...) at startup. So you have to use the
dst_uri (outbound address) field. Try:
ds_select_dst("1", "0");
avp_printf("$avp(i:100)", "sip:$dd:5061;transport=udp");
avp_pushto("$duri", "$avp(i:100)");
t_relay();
> Jul 11 14:43:31 davinci /usr/local/sbin/openser[16906]: ERROR: mk_proxy:
> could not resolve hostname: "$dd"
> Jul 11 14:43:31 davinci /usr/local/sbin/openser[16906]:
> ERROR:tm:fixup_phostport2proxy: failed to resolve <$dd>
> Jul 11 14:43:31 davinci /usr/local/sbin/openser[16906]: ERROR:
> fix_actions: fixing failed (code=-478) at cfg line 119
>
> anybody has any idea about how can i either:
> (A) set the preferred protocol and destination port for the transaction,
> then call t_relay() with no arguments, OR
> (B) capture the destination domain name selected by the dispatcher in a
> variable, append "udp:" in front of it and ":5061" at the end, and feed
> it as argument to t_relay().
>
> a hint would be great, a few lines of code would be even better ;) since
> i have some trouble locating the documentation for the core functions.
>
http://openser.org/dokuwiki/doku.php?id=openser_core_cookbook
http://www.openser.org/docs/modules/1.1.x/
Cheers,
Daniel
> thanks!
>
> Radu M.
>
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
>
>
More information about the Users
mailing list