Hi Daniel,Sorry for the confusion. As requested here is a coherent call sample including the debug changes, config, kamailio log, packet capture, and syslog. I've only attached the relevant CNAM_DIPS section of the config. It's a rather large config with many other routes but if need be I can provide the rest of the config.In regards to the 3xx responses. The CNAM provider returns a 380 with the CNAM in the PAID header but from my testing I've seen the 380 drop to the onreply_route[CNAM_DIPS] NOT faliure_route[CNAM_DIPS]. You can see in my config below that this is where I'm capturing the PAID header into an AVP. I was expecting the 380 to put me in the failure route and capture the CNAM there but instead I'm successfully capturing in on_reply.Config:route[CNAM_DIPS] {# Check call direction. If we're outbound nothing to do hereif ($avp(direction) == "in") {t_on_branch("CNAM_DIPS");t_on_reply("CNAM_DIPS");t_on_failure("CNAM_DIPS");$avp(cnam_dip_authorized) = 0;sql_xquery("routing", "SELECT * FROM callRoute WHERE telephoneNumber = '$var(dest_tn)'", "callRoute_cnam_query");$avp(cnam_dip_authorized) = $xavp(callRoute_cnam_query=>cnamDipAuthorized);append_branch("sip:8888888888@444.44.444.44:5060;trans-type=5", "0.5");t_load_contacts();t_next_contacts();t_relay();break;}}branch_route[CNAM_DIPS] {$var(modified_from) = "sip:" + $fU + "@sip.core.com";uac_replace_from("$var(modified_from)");}onreply_route[CNAM_DIPS] {if (t_check_status("380")) {xlog("L_INFO", "INFO: Received valid reply from TNSi (on_reply_route[CNAM_DIPS])");$avp(cnam) = $(hdr(P-Asserted-Identity){nameaddr.name});} else {xlog("L_ERROR", "INFO: Received bad reply from TNSi (on_reply_route[CNAM_DIPS])");};drop;}failure_route[CNAM_DIPS] {if (!t_next_contacts()) {xlog("L_ERR", "ERROR: Gateway failure (failure_route[CNAM_DIPS])");exit;} else {t_next_contacts();t_relay();};}___
John Petrini
NOC Systems Administrator // CoreDial, LLC // coredial.com //
Hillcrest I, 751 Arbor Way, Suite 150, Blue Bell PA, 19422
P: 215.297.4400 x232 // F: 215.297.4401 // E: jpetrini@coredial.comThe information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
On Mon, Jul 4, 2016 at 10:43 AM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:Hello,
it is really confusing how you provide details for troubleshooting -- if you want us to help you, then you have to be coherent in providing config snippets, logs and traces as used at that moment that exposed the issue. If you give something that not match, we work on invalid input, then lose time and interest in providing help.
To reset and restart with proper input:
- provide the relevant snippets that you use at the moment the issues are exposed
- load debugger module and set its cfgtrace parameter to 1
- set debug=3 in kamailio cfg and then rerun the tests, take the log messages from syslog and provide them hereI checked the source code and t_load_contacts() should not trigger any code in pv module, so the next log message that you pasted in your first email is not related to t_load_contacts(), you have something else in the configuration file:
>>> ERROR: pv [pv_branch.c:58]: pv_get_branchx(): error accessing branch [0]
So some other parts were not provided in the config snippets.
If you set a failure route, then you don't need to drop failure response codes such 3xx, it will be overwritten if you forward the request again. But if you don't forward the request in failure_route, then last winning response is sent in this case.
Cheers,
Daniel
On 04/07/16 16:14, jpetrini@coredial.com wrote:
Hi Daniel,
I have it commented out currently because neither seem to be working. The packet capture however was taken with drop uncommented and without the t_cancel_branches if statement. t_load_contacts was also commented out to avoid hitting the unable to load contact error.
Regards,
John Petrini
From: Daniel-Constantin Mierla
Sent: Monday, July 4, 2016 9:38 AM
To: John Petrini
Cc: Kamailio (SER) - Users Mailing List
Subject: Re: [SR-Users] (no subject)
Hello,
in the new email, the t_load_contacts() and drop are commented.
Is it how you have them in the config or again some formatting issue?
Cheers,
DanielOn 04/07/16 15:13, John Petrini wrote:
Hi Daniel,
I made a mistake with my formatting when I pasted here. I am calling append_branch() before t_load_contacts. I've attached a view of the entire route including where I was using drop; below. Also a packet capture that shows Kamailio forwarding the reply from the cnam provider back to the phone. I've discovered t_cancel_branches("this") and that seems to be doing the job of killing the second branch as well as the reply to the phone.
My main issue right now is serializing the branches, append_branch creates an additional branch but t_load_contacts fails. I've tried appending multiple branches and also using seturi to replicate the documentation as closely as possible with no luck.
route[CNAM_DIPS] {
if ($avp(direction) == "in") {
t_on_branch("CNAM_DIPS");
t_on_reply("CNAM_DIPS");
t_on_failure("CNAM_DIPS");
$var(reply_count) = 0;
append_branch("sip:8888888888@222.22.222.22:5060;trans-type=5", "0.5");
#t_load_contacts();
t_next_contacts();
t_relay();
break;
}
}
branch_route[CNAM_DIPS] {
$var(modified_from) = "sip:" + $fU + "@sip.core.com";
uac_replace_from("$var(modified_from)");
}
onreply_route[CNAM_DIPS] {
$var(reply_count) = $var(reply_count) + 1;
if (t_check_status("380")) {
$avp(cnam) = $(hdr(P-Asserted-Identity){nameaddr.name});
} else {
xlog("L_ERROR", "INFO: Received bad reply (on_reply_route[CNAM_DIPS]):");
};
if ($var(reply_count) = 1) {
t_cancel_branches("this");
}
#drop;
}
failure_route[CNAM_DIPS] {
if (!t_next_contacts()) {
xlog("L_ERR", "ERROR: Gateway failure (failure_route[CNAM_DIPS]): Failed to ship call");
exit;
} else {
t_next_contacts();
t_relay();
};
}
Packet capture using drop in the on_reply route rather than t_cancel_branches("this"):
U 2016/07/04 08:46:41.223295 44.444.4.444:5060 -> 333.33.33.3:5060
INVITE sip:+12222222222@core.com:5060 SIP/2.0.
Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.
From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.
To: <sip:2222222222@core.com>.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 INVITE.
Max-Forwards: 70.
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS.
Accept: application/sdp.
Contact: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.
P-Asserted-Identity: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.
Supported: replaces.
Content-Length: 281.
Content-Disposition: session; handling=required.
Content-Type: application/sdp.
.
v=0.
o=Sonus_UAC 807784 731434 IN IP4 44.444.4.444.
s=SIP Media Capabilities.
c=IN IP4 55.555.5.55.
t=0 0.
m=audio 54018 RTP/AVP 0 18 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendrecv.
a=ptime:20.
U 2016/07/04 08:46:41.230033 333.33.33.3:5060 -> 44.444.4.444:5060
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.
From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.
To: <sip:2222222222@core.com>.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 INVITE.
Server: kamailio (4.2.7 (x86_64/linux)).
Content-Length: 0.
.
U 2016/07/04 08:46:41.234143 333.33.33.3:5060 -> 222.22.222.22:5060
INVITE sip:8888888888@222.22.222.22:5060;trans-type=5 SIP/2.0.
Record-Route: <sip:333.33.33.3;lr;ftag=gK046fcff6;vsf=AAAAAAAAAAAAAAAAAAAAAABFXl4cUF5cXABSXl87aXN1cC1vbGk9NjI->.
Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.
Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.
From: "UNKNOWN" <sip:+13333333333@sip.core.com>;tag=gK046fcff6.
To: <sip:2222222222@core.com>.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 INVITE.
Max-Forwards: 69.
Allow: INVITE,ACK,CANCEL,BYE,OPTIONS.
Accept: application/sdp.
Contact: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.
P-Asserted-Identity: "UNKNOWN" <sip:+13333333333@44.444.4.444:5060>.
Supported: replaces.
Content-Length: 281.
Content-Disposition: session; handling=required.
Content-Type: application/sdp.
P-hint: branch_route CNAM_DIPS.
.
v=0.
o=Sonus_UAC 807784 731434 IN IP4 44.444.4.444.
s=SIP Media Capabilities.
c=IN IP4 55.555.5.55.
t=0 0.
m=audio 54018 RTP/AVP 0 18 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:18 G729/8000.
a=fmtp:18 annexb=no.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendrecv.
a=ptime:20.
U 2016/07/04 08:46:41.367868 222.22.222.22:5060 -> 333.33.33.3:5060
SIP/2.0 380 cnam lookup.
Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.
Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.
From: "UNKNOWN" <sip:+13333333333@sip.core.com>;tag=gK046fcff6.
To: <sip:2222222222@core.com>;tag=CNAM-16688-1467636671937.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 INVITE.
Contact: "CNAM" <sip:cnam_gw@10.212.16.30>; transport=udp.
Max-Forwards: 10.
P-Asserted-Identity: "Unavailable" <sip:+13333333333@sip.core.com>.
Content-Length: 0.
.
U 2016/07/04 08:46:41.368421 333.33.33.3:5060 -> 222.22.222.22:5060
ACK sip:8888888888@222.22.222.22:5060;trans-type=5 SIP/2.0.
Via: SIP/2.0/UDP 333.33.33.3;branch=z9hG4bK8ac3.daa229dcb24f16332fa5a21927e9a72f.0.
From: "UNKNOWN" <sip:+13333333333@sip.core.com>;tag=gK046fcff6.
To: <sip:2222222222@core.com>;tag=CNAM-16688-1467636671937.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 ACK.
Max-Forwards: 69.
Content-Length: 0.
.
U 2016/07/04 08:46:44.227076 333.33.33.3:5060 -> 44.444.4.444:5060
SIP/2.0 380 cnam lookup.
Via: SIP/2.0/UDP 44.444.4.444:5060;branch=z9hG4bK04Bef9112d99372eace.
From: "UNKNOWN" <sip:+13333333333@44.444.4.444;isup-oli=62>;tag=gK046fcff6.
To: <sip:2222222222@core.com>;tag=CNAM-16688-1467636671937.
Call-ID: 1698991986_66771899@44.444.4.444.
CSeq: 468700 INVITE.
Contact: "CNAM" <sip:cnam_gw@10.212.16.30>; transport=udp.
Max-Forwards: 10.
P-Asserted-Identity: "Unavailable" <sip:+13333333333@sip.core.com>.
Content-Length: 0.
P-hint: onreply CNAM_DIPS.
.
___
John Petrini
NOC Systems Administrator // CoreDial, LLC // coredial.com //
Hillcrest I, 751 Arbor Way, Suite 150, Blue Bell PA, 19422
P: 215.297.4400 x232 // F: 215.297.4401 // E: jpetrini@coredial.comThe information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.
--Daniel-Constantin Mierlahttp://www.asipto.com - http://www.kamailio.orghttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
-- Daniel-Constantin Mierla http://www.asipto.com - http://www.kamailio.org http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda