Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus
Probably you need to modify only the RURI. If you looking for a paid consultant you should post to the business mailing list. Also, you can take a look here: https://www.kamailio.org/w/business/
-ovidiu
On Thu, Sep 21, 2023 at 21:29 Markus universe@truemetal.org wrote:
Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi Markus,
Can you elaborate upon the way in which you are using Kamailio+RTPEngine "as a drop-in replacement"? Drop-in replacement for what? Or that is to say, what are you trying to accomplish here, functionally?
I have the suspicion that what you're doing is probably best accomplished in a different and more straightforward way. :-)
-- Alex
On Sep 21, 2023, at 8:58 PM, Markus universe@truemetal.org wrote:
Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hi Alex,
I'm trying to replace the Asterisk box with an instance of Kamailio+RTPEngine because the Asterisk box is heavily overloaded and calls that are passing through this box are encountering packet loss. The idea behind it is that the bundle of Kamailio+RTPEngine will be less CPU-intense than Asterisk and that the machine this bundle runs on would be able to handle the current call load without packet loss.
With "drop-in replacement" I meant that no changes on the upstream carrier side can be made for the moment (they're slow), thus I'm having to use the IP of the Asterisk box for the Kamailio+RTPengine bundle.
The purpose of the Asterisk box (and, once I got it to work, Kamailio+RTPEngine will be the replacement) is to route SIP voice calls from several other Asterisk boxes in the LAN to the carrier.
That single overloaded Asterisk box is the gateway to the carrier so to speak. And its IP 2.2.2.2 which is authorized to send INVITE's towards the carrier can't get changed on the carrier side for the moment.
Thanks :) Markus
Am 22.09.2023 um 03:56 schrieb Alex Balashov:
Hi Markus,
Can you elaborate upon the way in which you are using Kamailio+RTPEngine "as a drop-in replacement"? Drop-in replacement for what? Or that is to say, what are you trying to accomplish here, functionally?
I have the suspicion that what you're doing is probably best accomplished in a different and more straightforward way. :-)
So, forgive the silly question, but why do you need to do anything except to engage RTPEngine? Why rewrite any other SIP headers?
On Sep 22, 2023, at 5:11 AM, Markus via sr-users sr-users@lists.kamailio.org wrote:
Hi Alex,
I'm trying to replace the Asterisk box with an instance of Kamailio+RTPEngine because the Asterisk box is heavily overloaded and calls that are passing through this box are encountering packet loss. The idea behind it is that the bundle of Kamailio+RTPEngine will be less CPU-intense than Asterisk and that the machine this bundle runs on would be able to handle the current call load without packet loss.
With "drop-in replacement" I meant that no changes on the upstream carrier side can be made for the moment (they're slow), thus I'm having to use the IP of the Asterisk box for the Kamailio+RTPengine bundle.
The purpose of the Asterisk box (and, once I got it to work, Kamailio+RTPEngine will be the replacement) is to route SIP voice calls from several other Asterisk boxes in the LAN to the carrier.
That single overloaded Asterisk box is the gateway to the carrier so to speak. And its IP 2.2.2.2 which is authorized to send INVITE's towards the carrier can't get changed on the carrier side for the moment.
Thanks :) Markus
Am 22.09.2023 um 03:56 schrieb Alex Balashov:
Hi Markus, Can you elaborate upon the way in which you are using Kamailio+RTPEngine "as a drop-in replacement"? Drop-in replacement for what? Or that is to say, what are you trying to accomplish here, functionally? I have the suspicion that what you're doing is probably best accomplished in a different and more straightforward way. :-)
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hm. To use RTPEngine I need Kamailio, correct? Or can I use RTPEngine just with Asterisk?
If I need Kamailio: Kamailio in the default configuration is behaving differently than Asterisk in terms of the contents of the SIP header fields that it sends by default to the carrier IP (please see my first E-Mail in this thread where I compared the headers that Kamailio sends vs. the headers that Asterisk sends). This breaks the connection to the carrier so to speak (INVITE's not being accepted by the carrier). Thus, when I replace Asterisk with Kamailio, I need to modify Kamailio's config in a way that I get it to send exactly the same headers than Asterisk would.
If I don't need Kamailio: That would be great, but I'm thinking the load of just Asterisk + RTPEngine would be still higher than Kamailio + RTPEngine. I don't need any of the Asterisk features really, just need to forward and receive SIP packets, and I guess Kamailio is performing much better than Asterisk at this task.
Am 22.09.2023 um 17:38 schrieb Alex Balashov via sr-users:
So, forgive the silly question, but why do you need to do anything except to engage RTPEngine? Why rewrite any other SIP headers?
On Sep 22, 2023, at 5:11 AM, Markus via sr-users sr-users@lists.kamailio.org wrote:
Hi Alex,
I'm trying to replace the Asterisk box with an instance of Kamailio+RTPEngine because the Asterisk box is heavily overloaded and calls that are passing through this box are encountering packet loss. The idea behind it is that the bundle of Kamailio+RTPEngine will be less CPU-intense than Asterisk and that the machine this bundle runs on would be able to handle the current call load without packet loss.
With "drop-in replacement" I meant that no changes on the upstream carrier side can be made for the moment (they're slow), thus I'm having to use the IP of the Asterisk box for the Kamailio+RTPengine bundle.
The purpose of the Asterisk box (and, once I got it to work, Kamailio+RTPEngine will be the replacement) is to route SIP voice calls from several other Asterisk boxes in the LAN to the carrier.
That single overloaded Asterisk box is the gateway to the carrier so to speak. And its IP 2.2.2.2 which is authorized to send INVITE's towards the carrier can't get changed on the carrier side for the moment.
Thanks :) Markus
Am 22.09.2023 um 03:56 schrieb Alex Balashov:
Hi Markus, Can you elaborate upon the way in which you are using Kamailio+RTPEngine "as a drop-in replacement"? Drop-in replacement for what? Or that is to say, what are you trying to accomplish here, functionally? I have the suspicion that what you're doing is probably best accomplished in a different and more straightforward way. :-)
Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello,
to use rtpengine you need some kind of server like Kamailio, it does not work with asterisk.
Many people use Kamailio for carrier interconnection, in the end it is (as you already stated) just a matter of the correct configuration.
Cheers,
Henning
You can start with the following:
# Change URI(s) $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n"); OR # Insert new Contact header using the stored username insert_hf("Contact: sip:+61123123123@2.2.2.2:5060\r\n");
and then add the remaining modifications if needed as per your upstream carrier requirements.
Regards, Shah Hussain ________________________________ From: Markus universe@truemetal.org Sent: Friday, September 22, 2023 8:58 AM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Subject: [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast
Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Wow, cool, thanks! I added this snippet in the
request_route {
part, I hope that's correct. When I try to start Kamailio I get:
kamailio: Not starting : invalid configuration file! kamailio: 0(2371) ERROR: <core> [pvapi.c:828]: pv_parse_spec2(): error searching pvar "cU" kamailio: 0(2371) ERROR: <core> [pvapi.c:1032]: pv_parse_spec2(): wrong char [U/85] in [$cU] at [2 (0)] kamailio: 0(2371) : <core> [cfg.y:3368]: yyerror_at(): parse error in config file //etc/kamailio/kamailio.cfg, line 530, column 34-36: Can't get from cache: $cU
Somehow it doesn't know what $cU is?
It looks like this now:
... # authentication route(AUTH);
$ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n");
# record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) record_route(); ...
(formatting changed for E-Mail compatibility)
Thanks again, Markus
Am 22.09.2023 um 10:04 schrieb Shah Hussain Khattak:
You can start with the following:
# Change URI(s) $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n"); OR # Insert new Contact header using the stored username insert_hf("Contact: sip:+61123123123@2.2.2.2:5060\r\n");
and then add the remaining modifications if needed as per your upstream carrier requirements.
Regards, Shah Hussain
*From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 8:58 AM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Subject:* [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
I should have mentioned, please load the following modules:
loadmodule "textops.so" loadmodule "textopsx.so"
then restart Kamailio.
________________________________ From: Markus universe@truemetal.org Sent: Friday, September 22, 2023 5:58 PM To: sr-users@lists.kamailio.org sr-users@lists.kamailio.org Cc: Shah Hussain Khattak shahhusayn@msn.com Subject: Re: [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast
Wow, cool, thanks! I added this snippet in the
request_route {
part, I hope that's correct. When I try to start Kamailio I get:
kamailio: Not starting : invalid configuration file! kamailio: 0(2371) ERROR: <core> [pvapi.c:828]: pv_parse_spec2(): error searching pvar "cU" kamailio: 0(2371) ERROR: <core> [pvapi.c:1032]: pv_parse_spec2(): wrong char [U/85] in [$cU] at [2 (0)] kamailio: 0(2371) : <core> [cfg.y:3368]: yyerror_at(): parse error in config file //etc/kamailio/kamailio.cfg, line 530, column 34-36: Can't get from cache: $cU
Somehow it doesn't know what $cU is?
It looks like this now:
... # authentication route(AUTH);
$ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n");
# record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) record_route(); ...
(formatting changed for E-Mail compatibility)
Thanks again, Markus
Am 22.09.2023 um 10:04 schrieb Shah Hussain Khattak:
You can start with the following:
# Change URI(s) $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU; # Remove existing Contact header remove_hf("Contact"); # Insert new Contact header using the stored username insert_hf("Contact:
sip:$var(contact_username)@2.2.2.2:5060\r\n"); OR # Insert new Contact header using the stored username insert_hf("Contact: sip:+61123123123@2.2.2.2:5060\r\n");
and then add the remaining modifications if needed as per your upstream carrier requirements.
Regards, Shah Hussain
*From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 8:58 AM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Subject:* [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
textops.so was already loaded. Now added textopsx.so too but the error remains the same.
Is $cU a pseudo-variable that should be available within Kamailio by default? I can't find it here: https://www.kamailio.org/wiki/cookbooks/5.5.x/pseudovariables
Is it maybe $ct or something else? :)
"$ct - Contact header $ct - reference to body of contact header"
Thanks again, Markus
Am 22.09.2023 um 13:15 schrieb Shah Hussain Khattak:
I should have mentioned, please load the following modules:
loadmodule "textops.so" loadmodule "textopsx.so"
then restart Kamailio.
*From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 5:58 PM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Cc:* Shah Hussain Khattak shahhusayn@msn.com *Subject:* Re: [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Wow, cool, thanks! I added this snippet in the
request_route {
part, I hope that's correct. When I try to start Kamailio I get:
kamailio: Not starting : invalid configuration file! kamailio: 0(2371) ERROR: <core> [pvapi.c:828]: pv_parse_spec2(): error searching pvar "cU" kamailio: 0(2371) ERROR: <core> [pvapi.c:1032]: pv_parse_spec2(): wrong char [U/85] in [$cU] at [2 (0)] kamailio: 0(2371) : <core> [cfg.y:3368]: yyerror_at(): parse error in config file //etc/kamailio/kamailio.cfg, line 530, column 34-36: Can't get from cache: $cU
Somehow it doesn't know what $cU is?
It looks like this now:
... # authentication route(AUTH);
$ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n");
# record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) record_route(); ...
(formatting changed for E-Mail compatibility)
Thanks again, Markus
Am 22.09.2023 um 10:04 schrieb Shah Hussain Khattak:
You can start with the following:
# Change URI(s) $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2";
$var(contact_username) = $cU;
# Remove existing Contact header remove_hf("Contact");
# Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n"); OR # Insert new Contact header using the stored username insert_hf("Contact: sip:+61123123123@2.2.2.2:5060\r\n");
and then add the remaining modifications if needed as per your upstream carrier requirements.
Regards, Shah Hussain
*From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 8:58 AM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Subject:* [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Hi list,
I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario.
My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3
sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved.
2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1
v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20
I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work:
INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0
To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone
From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd
Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060
Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060
o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2
My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU <https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU>
These are the Asterisk boxes I want to originate calls from to Kamailio:
[root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+
This is the upstream carrier I want Kamailio to proxy calls to:
[root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail)
As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful.
Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hmm, try to use: subst_hf() then:
3.15. subst_hf(hf, subexp, flags)
Perl-like substitutions in the body of a header field.
Meaning of the parameters is as follows:
* hf - header field name.
* subexp - substitution expression in the same format as of the 'subst' function parameter.
* flags - control flags - it has to be one of: a - all headers matching the name; f - only first header matching the name; l - only the last header matching the name.
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE.
Example 1.15. search_body usage
... if ( subst_hf("From", "/:test@/:best@/", "a") ) { /*....*/ }; ...
For example, from one google search:
subst_hf("Contact", "/(.*)?<(sip):(.*)@(.*)/sip:$var(pilot_tn)@xxx.xxx.xxx.xxx:5060;transport=udp/", "a");
Sent from my iPhone
On 22 Sep 2023, at 9:25 pm, Markus universe@truemetal.org wrote:
textops.so was already loaded. Now added textopsx.so too but the error remains the same.
Is $cU a pseudo-variable that should be available within Kamailio by default? I can't find it here: https://www.kamailio.org/wiki/cookbooks/5.5.x/pseudovariables
Is it maybe $ct or something else? :)
"$ct - Contact header $ct - reference to body of contact header"
Thanks again, Markus
Am 22.09.2023 um 13:15 schrieb Shah Hussain Khattak: I should have mentioned, please load the following modules: loadmodule "textops.so" loadmodule "textopsx.so" then restart Kamailio. ------------------------------------------------------------------------ *From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 5:58 PM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Cc:* Shah Hussain Khattak shahhusayn@msn.com *Subject:* Re: [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Wow, cool, thanks! I added this snippet in the request_route { part, I hope that's correct. When I try to start Kamailio I get: kamailio: Not starting : invalid configuration file! kamailio: 0(2371) ERROR: <core> [pvapi.c:828]: pv_parse_spec2(): error searching pvar "cU" kamailio: 0(2371) ERROR: <core> [pvapi.c:1032]: pv_parse_spec2(): wrong char [U/85] in [$cU] at [2 (0)] kamailio: 0(2371) : <core> [cfg.y:3368]: yyerror_at(): parse error in config file //etc/kamailio/kamailio.cfg, line 530, column 34-36: Can't get from cache: $cU Somehow it doesn't know what $cU is? It looks like this now: ... # authentication route(AUTH); $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2"; $var(contact_username) = $cU; # Remove existing Contact header remove_hf("Contact"); # Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n"); # record routing for dialog forming requests (in case they are routed) # - remove preloaded route headers remove_hf("Route"); if (is_method("INVITE|SUBSCRIBE")) record_route(); ... (formatting changed for E-Mail compatibility) Thanks again, Markus Am 22.09.2023 um 10:04 schrieb Shah Hussain Khattak: You can start with the following: # Change URI(s) $ru = "sip:" + $rU + "@3.3.3.3"; $tu = "sip:" + $tU + "@3.3.3.3"; $fu = "sip:" + $fU + "@2.2.2.2"; $var(contact_username) = $cU; # Remove existing Contact header remove_hf("Contact"); # Insert new Contact header using the stored username insert_hf("Contact: sip:$var(contact_username)@2.2.2.2:5060\r\n"); OR # Insert new Contact header using the stored username insert_hf("Contact: sip:+61123123123@2.2.2.2:5060\r\n"); and then add the remaining modifications if needed as per your upstream carrier requirements. Regards, Shah Hussain ------------------------------------------------------------------------ *From:* Markus universe@truemetal.org *Sent:* Friday, September 22, 2023 8:58 AM *To:* sr-users@lists.kamailio.org sr-users@lists.kamailio.org *Subject:* [SR-Users] Modifying SDP as drop-in replacement for overloaded Asterisk box - looking for help/paid consulting fast Hi list, I'm trying to use Kamailio 4.4.4 with rtpengine in a self-inflicted emergency situation (didn't monitor traffic growth properly and now encountering packet loss during peak times) as a drop-in replacement for an overloaded Asterisk box in a call-termination-to-upstream-carrier scenario. My test scenario is to make a call from a SIP softphone to Asterisk IP 1.1.1.1 -> Kamailio/rtpengine IP 2.2.2.2 -> Upstream carrier 3.3.3.3 sngrep on Kamailio box 2.2.2.2 - the following SDP will not work - carrier is rejecting it. Carrier is authenticating our calls based on our IP address 2.2.2.2, no username/pass involved. 2023/09/22 02:06:49.216136 2.2.2.2:5060 -> 3.3.3.3:5060 INVITE sip:+32xxxxxxxx@2.2.2.2;user=phone SIP/2.0 Record-Route: sip:2.2.2.2;lr Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bKd9c3.d6fa3abe5d52b827e2054de5573028e0.0 Via: SIP/2.0/UDP 1.1.1.1:5060;branch=z9hG4bK473270e8 Max-Forwards: 69 From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd To: sip:+32xxxxxxxx@2.2.2.2;user=phone Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 CSeq: 102 INVITE User-Agent: Asterisk PBX 20.0.0 Date: Fri, 22 Sep 2023 00:06:50 GMT Session-Expires: 1800 Min-SE: 90 Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE Supported: replaces, timer P-Asserted-Identity: sip:+61xxxxxxxxx@2.2.2.2;user=phone Content-Type: application/sdp Content-Length: 314 X-SIP: 1.1.1.1 v=0 o=root 1093000903 1093000903 IN IP4 1.1.1.1 s=Asterisk PBX 20.0.0 c=IN IP4 2.2.2.2 t=0 0 m=audio 25742 RTP/AVP 8 9 0 101 a=maxptime:150 a=rtpmap:8 PCMA/8000 a=rtpmap:9 G722/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=sendrecv a=rtcp:25743 a=ptime:20 I'm comparing this rejected INVITE to a successful INVITE sent by the original Asterisk box at IP 2.2.2.2 (now Kamailio box) to the carrier without Kamailio in the path, and these are the differences I noticed, and probably the things I have to mimick with Kamailio in order to make it work: INVITE sip:+32xxxxxxxxx@2.2.2.2;user=phone SIP/2.0 should be INVITE sip:+32xxxxxxxxx@3.3.3.3;user=phone SIP/2.0 To: sip:+32xxxxxxxx@2.2.2.2;user=phone should be To: sip:+32xxxxxxxx@3.3.3.3;user=phone From: "61xxxxxxxxx" sip:+61xxxxxxxxx@1.1.1.1;tag=as3d75aadd should be From: "61xxxxxxxxx" sip:+61xxxxxxxxx@2.2.2.2;tag=as3d75aadd Contact: sip:+61xxxxxxxxx@1.1.1.1:5060 should be Contact: sip:+61xxxxxxxxx@2.2.2.2:5060 Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@1.1.1.1:5060 should be Call-ID: 3f31e1622a72b6d17f24e42362f4f1d0@2.2.2.2:5060 o=root 1093000903 1093000903 IN IP4 1.1.1.1 should be o=root 1093000903 1093000903 IN IP4 2.2.2.2 My kamailio.cfg can be found here: https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU <https://pastebin.com/6PKcRjPU https://pastebin.com/6PKcRjPU> These are the Asterisk boxes I want to originate calls from to Kamailio: [root@voip30 ~]# kamctl address show +-----+-----+----------+------+------+-----------+ | id | grp | ip_addr | mask | port | tag | +-----+-----+----------+------+------+-----------+ | 195 | 1 | 1.1.1.1 | 32 | 0 | voip20.sv | | 196 | 1 | 1.1.1.2 | 32 | 0 | voip21.sv | | 197 | 1 | 1.1.1.3 | 32 | 0 | voip22.sv | | 198 | 1 | 1.1.1.4 | 32 | 0 | voip23.sv | | 199 | 1 | 1.1.1.5 | 32 | 0 | voip24.sv | | 200 | 1 | 1.1.1.6 | 32 | 0 | voip25.sv | | 201 | 1 | 1.1.1.7 | 32 | 0 | voip26.sv | | 202 | 1 | 1.1.1.8 | 32 | 0 | voip27.sv | | 203 | 1 | 1.1.1.9 | 32 | 0 | voip28.sv | +-----+-----+----------+------+------+-----------+ This is the upstream carrier I want Kamailio to proxy calls to: [root@voip30 ~]# kamctl dispatcher show dispatcher gateways +----+-------+------------------+-------+-------+------------+------+ | id | setid | destination | flags | prio. | attrs | desc | +----+-------+------------------+-------+-------+------------+------+ | 12 | 1 | sip:3.3.3.3:5060 | 0 | 0 | weight=100 | | +----+-------+------------------+-------+-------+------------+------+ (output manually slightly modified to look properly over E-Mail) As you might have guessed I'm a Kamailio noob... and don't have the resources to learn it as fast as I must to avoid further packet loss. If there's anyone available who can help me to get this done today, optionally in exchange for money, I'd be grateful. Thank you! Markus __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions To unsubscribe send an email to sr-users-leave@lists.kamailio.org Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe: