how to set up kamailio proxy server and route calls to twilio? -


i trying route calls twilio through kamailio proxy. config file, call gets connected , automatically drops after 30 seconds. because ack sent twilio 200 ok not correct. twilio expects ack ruri same contact in 200 ok response, kamailio sent different. how fix error?

200 ok response, ack forwarded , kamailio config file postes in paste bin , please check below link.(its not easy paste code here)

http://pastebin.com/hylvtt23

now trying change sip ruri storing contact htable 200 , forward ack . not working, cant store contact 200 htable , use in ack.please see code config file ,by tying.

     if(status=="200")   {      $var(x) = $ct;     $var(c) = $(var(x){nameaddr.uri});     $sht(b=>ru)=$var(c);     exit;   }  if ( is_method("ack") && $si=="64.2.142.90") {         $du = "sip:xxxxxxx.sip.twilio.com";          $ru=$sht(b=>ru);          forward();         exit;         } 

for proper analysis, incoming ack kamailio needed along 1 sent out kamailio.

i can try guess happens there. looking @ 200ok, there 3 record-route headers, means there 3 sip proxies routing call. assume kamailio on 107.21.211.20:5060 (this ip not in via stack of 200ok reply, making me think 200ok pasted 1 kamailio sent towards caller).

then, 2nd (54.69.159.69:5060) , 3rd (64.2.142.90) record-route headers in 200ok use lr=on parameter, quite specific ser-like proxy (ser, older kamailio (including openser) or other variants).

i conclude between caller , kamailio 2 other such proxies. likely, 2nd (54.69.159.69:5060) has nat traversal routing logic. doesn't right. looks @ contact header in 200ok , sees private ip, concluding callee behind nat , replacing contact source ip , port of 200ok, ones of kamailio.

to confirm this, need see 200ok received caller -- see contact header there. if confirmed, solutions are:

1) in contact owner of 2nd proxy , tell him proper nat traversal processing. if proxy after proxy, should not on side of sip traffic. if using kamailio there, must switch using fix_nated_contact() using set_contact_alias()/handle_contact_alias() dealing natted contacts , r-uri towards natted destinations (example in default config file latest kamailio versions 4.2.x or 4.1.x)

2) if 1) not solution, have fix in kamailio, can done using set_contact_alias()/handle_contact_alias(). appears kamailio first hop next twilio ua behind nat, should anyhow.

note solution 2) might not work if twilio ua restrictive on incoming r-uri -- 2nd proxy processing lose ip of twilio ua. if case, have additional tricks store original contact 200ok sent twilio. in can done either via parameter in contact uri or using htable , store on kamailio memory, use when receive ack (same needed re-invite or bye).


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

xcode - Swift Playground - Files are not readable -

jboss7.x - JBoss AS 7.3 vs 7.4 and differences -