[Users] t_relay() to a destination set by dispatcher

Radu Maierean radu at jambotech.com
Tue Jul 11 22:49:44 CEST 2006

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
if (uri=~"^sip:\+1[0-9]+ at xx\.xx\.xx\.xx") {
   if ((method=="INVITE") || (method=="CANCEL")) {
      ds_select_dst("1", "0");

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:

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.


Radu M.

More information about the sr-users mailing list