Re: SIP Diversion Problem
Sergio Charrua via sr-users <[email protected]>
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <CALZWR5zaTYJ=fYutKoumF=C1mCvo_tycQk50oL9mKx_WOvufTg@mail.gmail.com> |
remove_hf removes all the identified header (as found in textops docs: "Remove
from message all headers with name “hname”. " ),
so why are you removing headers inside the loop? The 1st time
remove_hf("Diversion"); should be enough
Why not just do:
remove_hf("Diversion");
$var(i) = 0;
while($var(i) < $hflc(Diversion) ) {
$vn(new_div) = $(hfl(Diversion)[1]);
$var(i) = $var(i) +1;
}
Atenciosamente / Kind Regards / Cordialement / Un saludo,
*Sérgio Charrua*
On Mon, Sep 8, 2025 at 8:16 AM ale Gural via sr-users <
[email protected]> wrote:
> Hello,
> Thanks for your quick response,
> I need to normalize the Diversion Header from <sip:[email protected]>
> *To this* <sip:[email protected]
> ;user=phone>;privacy=off;reason=unconditional;counter=1
>
> my script will transform from:
>
> INVITE sip:[email protected]:5060;user=phone SIP/2.0
> Via: SIP/2.0/UDP 10.25.170.15:5060;branch=z9hG4bKjsc2h0200geck6dm22p0.1
> From: "TREST"<sip:[email protected]:5060
> ;transport=UDP;user=phone>;tag=1697477218-1-1643299018-1243107461
> To: <sip:[email protected]:5060;transport=UDP;user=phone>
> Call-ID: 1cc9049b-2da69688-1f3af2-7fd7a68b3550-93c80a0a-9aa-759
> CSeq: 1 INVITE
> Diversion: "39988246 39988246" <sip:[email protected]
> >;privacy=off;reason=unconditional;counter=1,<sip:[email protected]>,<
> sip:[email protected]
> ;user=phone>;privacy=off;reason=unconditional;counter=1
> Supported: timer,100rel
> Max-Forwards: 63
> Contact: <sip:[email protected]:5060;user=phone;transport=udp>
> Allow: INVITE,CANCEL,ACK,BYE,OPTIONS,INFO,PRACK,UPDATE,REFER,NOTIFY
> Session-Expires: 1800
> Min-SE: 90
> Content-Type: application/sdp
> Content-Length: 257
>
> v=0
> o=BN4000 3698905 3698906 IN IP4 10.10.10.216
> s=-
> c=IN IP4 10.10.10.216
> t=0 0
> a=sendrecv
> m=audio 50118 RTP/AVP 8 0 98
> c=IN IP4 10.10.10.216
> a=rtpmap:8 PCMA/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:98 telephone-event/8000
> a=fmtp:98 0-15
> a=maxptime:40
>
>
>
> TO:
>
> INVITE sip:[email protected]:5060;user=phone SIP/2.0
> Via: SIP/2.0/UDP
> 10.25.194.166;branch=z9hG4bKd2.4d9e11a28b13a79d278fed51190be1c5.1
> From: <sip:[email protected]:5060
> ;transport=UDP;user=phone>;tag=BN1697477218-1-1643299018-1243107461
> To: <sip:[email protected]:5060;transport=UDP;user=phone>
> Call-ID: 1cc9049b-2da69688-1f3af2-7fd7a68b3550-93c80a0a-9aa-759
> CSeq: 1 INVITE
> Max-Forwards: 62
> Contact: <sip:[email protected]:5060;user=phone;transport=udp>
> Allow: INVITE,CANCEL,ACK,BYE,OPTIONS,PRACK,UPDATE,NOTIFY
> Supported: 100rel
> Diversion: "39988246 39988246" <sip:[email protected]
> >;privacy=off;reason=unconditional;counter=1
> Diversion: <sip:[email protected]>;privacy=off;counter=1
> Diversion: <sip:[email protected]
> ;user=phone>;privacy=off;reason=unconditional;counter=1
> Content-Type: application/sdp
> Content-Length: 257
>
> v=0
> o=BN4000 3698903 3698903 IN IP4 10.10.10.216
> s=-
> c=IN IP4 10.10.10.216
> t=0 0
> a=sendrecv
> m=audio 50118 RTP/AVP 8 0 98
> c=IN IP4 10.10.10.216
> a=rtpmap:8 PCMA/8000
> a=rtpmap:0 PCMU/8000
> a=rtpmap:98 telephone-event/8000
> a=fmtp:98 0-15
> a=maxptime:40
>
> Thanks!
>
> On Sun, Sep 7, 2025 at 10:18 PM Alex Balashov via sr-users <
> [email protected]> wrote:
>
>> I wonder if manipulating the header structure while iterating through it
>> isn't safe.
>>
>> > On Sep 7, 2025, at 10:35 AM, ale Gural via sr-users <
>> [email protected]> wrote:
>> >
>> > Hello,
>> > I am using version: kamailio 5.8.6
>> > I try to send in INVITE message the follow Diversion header,
>> >
>> > Diversion: "39988246 39988246" <sip:[email protected]
>> >;privacy=off;reason=unconditional;counter=1,<sip:[email protected]
>> >,<sip:[email protected]
>> ;user=phone>;privacy=off;reason=unconditional;counter=1
>> > in my script code I need to separate every diversion Multibody wit the
>> follow (example):
>> > $var(i) = 0;
>> > while($var(i) < $hflc(Diversion) ) {
>> > remove_hf("Diversion");
>> > $vn(new_div) = $(hfl(Diversion)[1]);
>> > $var(i) = $var(i) +1;
>> > }
>> >
>> > when $var(i) = 1, the kamailio make restart with exit by signal 11
>> >
>> >
>> > I appreciate your help!
>> >
>> >
>> >
>> >
>> > __________________________________________________________
>> > Kamailio - Users Mailing List - Non Commercial Discussions --
>> [email protected]
>> > To unsubscribe send an email to [email protected]
>> > Important: keep the mailing list in the recipients, do not reply only
>> to the sender!
>>
>> --
>> Alex Balashov
>> Principal Consultant
>> Evariste Systems LLC
>> Web: https://evaristesys.com, https://www.csrpswitch.com
>> Tel: +1-706-510-6800
>>
>> __________________________________________________________
>> Kamailio - Users Mailing List - Non Commercial Discussions --
>> [email protected]
>> To unsubscribe send an email to [email protected]
>> Important: keep the mailing list in the recipients, do not reply only to
>> the sender!
>>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions --
> [email protected]
> To unsubscribe send an email to [email protected]
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!