I should have mentioned, please load the following modules:

loadmodule "textops.so"
loadmodule "textopsx.so"

then restart Kamailio.

________________________________
From: Markus <unive...@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 <shahhus...@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 <unive...@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-le...@lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:

__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to