[OpenSIPS-Users] error when use function t_relay

nguyen khue minhkhue49da at yahoo.com
Thu Sep 15 08:52:02 CEST 2011


Hi Robert,

My model: kapanga --> sipproxy (opensips-1.6.2) --> asterisk (1.6)
kapanga: 192.168.0.34
sipproxy: 192.168.0.35
asterisk: 192.168.0.179

This is my config file (reduce):


if (is_method("INFO")){
                #t_relay();
                if (!vega_process_info()){
                        xlog("L_ERR","New service is not accept\n");
                        sl_send_reply("503", "Service unavaiable");
                        exit;
                }
        }
if (is_method("BYE")){
xlog("BYE from user $fU===========\n");
vega_process_bye();
}
.
.
.
if (!lookup("location","m")) {
switch ($retcode) {
case -1:
case -3:
route(2);
exit;
case -2:
sl_send_reply("405", "Method Not Allowed");
exit;
}
}

route[2]{
if (is_method("INVITE")){
if (!has_totag()){
if (vega_process_invite()){
t_on_branch("2");
t_on_failure("1");
t_on_reply("2");
if ($fU =~"999887[0-9][0-9][0-9]"){
load_balance("1","pstn");
if (!t_relay()){
sl_reply_error();
}
}
else {
load_balance("2","pstn");
if (!t_relay()){
sl_reply_error();
}
}

}
else {
xlog("Process INVITE failed, drop call anyway\n");
sl_send_reply("404","Not Here");
exit;
}
}
}
exit;
}

and this is some messages that I capture on sipproxy

invite from kapanga to sipproxy

INVITE sip:1909 at 192.168.0.35 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.34:5060;branch=z9hG4bK2FCE61014FFB157699D2906A0C7172F2;rport
From: "977887006" <sip:977887006 at 192.168.0.34:5060>;tag=A41C8BEBD152FC23D0F86F05097433AD
To: <sip:1909 at 192.168.0.35>
Contact: <sip:977887006 at 192.168.0.34:5060;transport=udp>
Call-ID: 2290815DDEAF262E60B1857F1F4FEDF1 at 192.168.0.34
User-Agent: Kapanga Softphone Desktop Windows 1.00/2178d+1305879468_00FF3CC2A86A_0026C685F9F7_0026C685F9F6_0022681CF3DC_005056C00001_005056C00008
Supported: timer, replaces
CSeq: 1 INVITE
Max-Forwards: 70
Session-Expires: 1800;refresher=uac
Content-Type: application/sdp
Content-Length: 328

v=0
o=977887006 1316061208 1316061969 IN IP4 192.168.0.34
s=Kapanga [1316061208]
c=IN IP4 192.168.0.34
t=0 0
m=audio 5124 RTP/AVP 0 8
a=rtpmap:0 pcmu/8000
a=sendrecv
a=rtcp:5125
a=maxptime:20
a=ptime:20
a=rtpmap:8 pcma/8000
m=video 5126 RTP/AVP 34
a=rtpmap:34 h263/90000
a=fmtp:34 QCIF=2
a=sendrecv
a=rtcp:5127

invite from sipproxy to asterisk

INVITE sip:1909 at 192.168.0.35 SIP/2.0
Record-Route: <sip:192.168.0.35;lr;did=6e.f7fe4794>
Via: SIP/2.0/UDP 192.168.0.35;branch=z9hG4bKd111.31b776c6.0
Via: SIP/2.0/UDP 192.168.0.34:5060;received=192.168.0.34;branch=z9hG4bK2FCE61014FFB157699D2906A0C7172F2;rport=5060
From: "977887006" <sip:977887006 at 192.168.0.34:5060>;tag=A41C8BEBD152FC23D0F86F05097433AD
To: <sip:1909 at 192.168.0.35>
Contact: <sip:977887006 at 192.168.0.34:5060;transport=udp>
Call-ID: 2290815DDEAF262E60B1857F1F4FEDF1 at 192.168.0.34
User-Agent: Kapanga Softphone Desktop Windows 1.00/2178d+1305879468_00FF3CC2A86A_0026C685F9F7_0026C685F9F6_0022681CF3DC_005056C00001_005056C00008
Supported: timer, replaces
CSeq: 1 INVITE
Max-Forwards: 69
Session-Expires: 1800;refresher=uac
Content-Type: application/sdp
Content-Length: 328

v=0
o=977887006 1316061208 1316061969 IN IP4 192.168.0.34
s=Kapanga [1316061208]
c=IN IP4 192.168.0.34
t=0 0
m=audio 5124 RTP/AVP 0 8
a=rtpmap:0 pcmu/8000
a=sendrecv
a=rtcp:5125
a=maxptime:20
a=ptime:20
a=rtpmap:8 pcma/8000
m=video 5126 RTP/AVP 34
a=rtpmap:34 h263/90000
a=fmtp:34 QCIF=2
a=sendrecv
a=rtcp:5127

INVITE message can reach destination.

200 ok from asterisk to sipproxy, and sipproxy cannot forward it to destination (kapanga). This message repeat six times.
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.35;branch=z9hG4bKd111.31b776c6.0;received=192.168.0.35
Via: SIP/2.0/UDP 192.168.0.34:5060;received=192.168.0.34;branch=z9hG4bK2FCE61014FFB157699D2906A0C7172F2;rport=5060
Record-Route: <sip:192.168.0.35;lr;did=6e.f7fe4794>
From: "977887006" <sip:977887006 at 192.168.0.34:5060>;tag=A41C8BEBD152FC23D0F86F05097433AD
To: <sip:1909 at 192.168.0.35>;tag=as73bce553
Call-ID: 2290815DDEAF262E60B1857F1F4FEDF1 at 192.168.0.34
CSeq: 1 INVITE
Server: Asterisk PBX 1.8.4.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Session-Expires: 1800;refresher=uac
Contact: <sip:1909 at 192.168.0.179:5060>
Content-Type: application/sdp
Content-Length: 255

v=0
o=root 1931374264 1931374264 IN IP4 192.168.0.179
s=Asterisk PBX 1.8.4.2
c=IN IP4 192.168.0.179
t=0 0
m=audio 18222 RTP/AVP 0 8
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
m=video 0 RTP/AVP 34

200 OK message cannot reach to destination, I captured 6 messages.

INFO sip:1909 at 192.168.0.179 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.34:5060;branch=z9hG4bK1D752E2B2641DAF42286B4D2B874F6DA;rport
Route: <sip:192.168.0.35;lr;did=6e.f7fe4794>
From: "977887006" <sip:977887006 at 192.168.0.34:5060>;tag=A41C8BEBD152FC23D0F86F05097433AD
To: <sip:1909 at 192.168.0.35>;tag=as73bce553
Contact: <sip:977887006 at 192.168.0.34:5060;transport=udp>
Call-ID: 2290815DDEAF262E60B1857F1F4FEDF1 at 192.168.0.34
User-Agent: Kapanga Softphone Desktop Windows 1.00/2178d+1305879468_00FF3CC2A86A_0026C685F9F7_0026C685F9F6_0022681CF3DC_005056C00001_005056C00008
Supported: timer, replaces
CSeq: 2 INFO
Max-Forwards: 70
Content-Type: application/dtmf-relay
Content-Length: 24

Signal=1
Duration=150

INFO message is same, it cannot reach to destination

Khue Nguyen

________________________________
From: Robert Thomas <thomcr at gmail.com>
To: nguyen khue <minhkhue49da at yahoo.com>; OpenSIPS users mailling list <users at lists.opensips.org>
Sent: Thursday, September 15, 2011 11:22 AM
Subject: Re: [OpenSIPS-Users] error when use function t_relay


Hi Khue,

Can you please post your full opensips.cfg file, and a packet capture so we can understand better what opensips is doing to the sip packets. A capture with ngrep with work as well. 

That way we can try to help.


On Mon, Sep 12, 2011 at 10:19 PM, nguyen khue <minhkhue49da at yahoo.com> wrote:

Hi all,
>
>
>I have a module to process SIP message (INVITE, INFO, 200 OK, BYE). I have use t_relay function to capture 200 OK message in block onreply_route. But, After I use t_relay function, INFO, BYE, some ACKs messages cannot route to destination. If I insert some t_relay function in config file, it work normal.
>
>
>ex:
>if (is_method("INFO")){
>t_relay();  // if this function is missing, the SIP INFO cannot reach the destination
>process_info_msg();
>}
>.
>.
>.
>
>
>route[1]{
>t_on_branch("2"); t_on_failure("1"); t_on_reply("2");
>process_invite_msg();
>if ($fU == xxxx){
>load_balance("1","transc");
>}
>else {
>load_balance("2","transc");
>}
>if(!t_relay()){
>sl_reply_error():
>}
>exit;
>}
>
>
>onreply_route[2]{
>process_ok_msg();
>}
>
>
>I using opensips-1.6.2. My module is : kapanga -> opensips -> asterisk. Kapanga and Asterisk don't register to opensips.
>Please help me resolve this problem.
>
>
>Thank you very much
>Khue Nguyen.
>_______________________________________________
>Users mailing list
>Users at lists.opensips.org
>http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>


-- 
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110914/36b66d16/attachment-0001.htm>


More information about the Users mailing list