Re: [OpenSIPS-Users] Media server communication with OpenSIPS

2022-12-29 Thread Wadii ELMAJDI | Evenmedia
Hello,

The invite is relayed from OpenSIPS to Asterisk. Asterisk has UAS role here.
The data i'm hoping to transfer to OPENSIPS should be sent either with the 200 
OK (Asterisk to OpenSIPS), during the call, or via BYE.
So neither PJSIP_HEADER nor PJSIP_RESPONSE_HEADER can help with my usecase.
I have already used  pjsip session refresh to renegotiate media codecs during a 
call, but i've never tried adding an extraheader to the re-invite/update method.
I will try this asap, thank you for the detailed answer.



De : Users  de la part de Gregory Massel 

Envoyé : jeudi 29 décembre 2022 20:28
À : users@lists.opensips.org 
Objet : Re: [OpenSIPS-Users] Media server communication with OpenSIPS


You can send custom headers from Asterisk to OpenSIPS using:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_HEADER

If you need Asterisk to receive customer headers from OpenSIPS, you can read 
custom headers added by OpenSIPS to its 200 response using:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_RESPONSE_HEADER


If you are already midway through a call, you can force an UPDATE or re-INVITE 
using:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_SEND_SESSION_REFRESH


While I haven't personally tested, I'd expect that you should be able to signal 
custom information midway through a call with a 
Set(PJSIP_HEADER(add,X-MyHeader)=myvalue) followed by a 
Set(PJSIP_SEND_SESSION_REFRESH()=invite). This should then trigger a re-INVITE 
carrying the new X-MyHeader within it.

Similarly, after triggering the a re-INVITE or UPDATE, you should then be able 
to do a Set(MYVAR=PJSIP_RESPONSE_HEADER(read,X-MyHeader)) to extract what 
OpenSIPS has sent back to Asterisk in its 200 response.


Although more messy, there are also other tricks that you can use, including 
the CONNECTEDLINE function:

https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_CONNECTEDLINE

e.g. If you did a 
Set(CONNECTEDLINE(name)=Information_I_wish_to_share_with_OpenSIPS), then this 
will, in one step, trigger an UPDATE or re-INVITE carrying the new connected 
party name in the SIP headers, detail which you can then extract from OpenSIPS. 
Similarly, you can also use this approach read information that OpenSIPS has 
sent to Asterisk, with a Set(MYVAR=CONNECTEDLINE(name)).

I mention this in case, for whatever reason, the first approach (described 
above) doesn't work as planned, however, the first approach is definitely 
preferable as you can carry the information in your own X- header, making it 
far easier to send/receive multiple headers.

On Tue, Dec 27, 2022 at 8:55 AM Wadii ELMAJDI | Evenmedia 
mailto:wa...@evenmedia.fr>> wrote:
>
> Hello,
>
>
> I am using Asterisk as a media server behind OpenSIPS.
> I need to send some additional data to opensips during the call or at the 
> latest during the hangup. For instance a custom hang up reason.
> Asterisk does not allow neither to send a sequential request withing an 
> ongoing dialog, nor add headers to a BYE method.
> The current solution I’m using is pushing a dialog var (dlg_push_var) using 
> Call-ID via (mi_http), but that means I rely on a curl http request during my 
> call…
> Is there any better option for a direct communication between the two boxes 
> during a call ? without any intermediate server (Redis DB …)
>
> Thank you
>
> ___
> Users mailing list
> Users@lists.opensips.org<mailto:Users@lists.opensips.org>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



___
Users mailing list
Users@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Media server communication with OpenSIPS

2022-12-29 Thread Gregory Massel

You can send custom headers from Asterisk to OpenSIPS using:

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_HEADER

If you need Asterisk to receive customer headers from OpenSIPS, you can 
read custom headers added by OpenSIPS to its 200 response using:


https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_RESPONSE_HEADER


If you are already midway through a call, you can force an UPDATE or 
re-INVITE using:


https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_PJSIP_SEND_SESSION_REFRESH


While I haven't personally tested, I'd expect that you should be able to 
signal custom information midway through a call with a 
Set(PJSIP_HEADER(add,X-MyHeader)=myvalue) followed by a 
Set(PJSIP_SEND_SESSION_REFRESH()=invite). This should then trigger a 
re-INVITE carrying the new X-MyHeader within it.


Similarly, after triggering the a re-INVITE or UPDATE, you should then 
be able to do a Set(MYVAR=PJSIP_RESPONSE_HEADER(read,X-MyHeader)) to 
extract what OpenSIPS has sent back to Asterisk in its 200 response.



Although more messy, there are also other tricks that you can use, 
including the CONNECTEDLINE function:


https://wiki.asterisk.org/wiki/display/AST/Manipulating+Party+ID+Information

https://wiki.asterisk.org/wiki/display/AST/Asterisk+18+Function_CONNECTEDLINE

e.g. If you did a 
Set(CONNECTEDLINE(name)=Information_I_wish_to_share_with_OpenSIPS), then 
this will, in one step, trigger an UPDATE or re-INVITE carrying the new 
connected party name in the SIP headers, detail which you can then 
extract from OpenSIPS. Similarly, you can also use this approach read 
information that OpenSIPS has sent to Asterisk, with a 
Set(MYVAR=CONNECTEDLINE(name)).


I mention this in case, for whatever reason, the first approach 
(described above) doesn't work as planned, however, the first approach 
is definitely preferable as you can carry the information in your own X- 
header, making it far easier to send/receive multiple headers.


On Tue, Dec 27, 2022 at 8:55 AM Wadii ELMAJDI | Evenmedia 
 wrote:

>
> Hello,
>
>
> I am using Asterisk as a media server behind OpenSIPS.
> I need to send some additional data to opensips during the call or 
at the latest during the hangup. For instance a custom hang up reason.
> Asterisk does not allow neither to send a sequential request withing 
an ongoing dialog, nor add headers to a BYE method.
> The current solution I’m using is pushing a dialog var 
(dlg_push_var) using Call-ID via (mi_http), but that means I rely on a 
curl http request during my call…
> Is there any better option for a direct communication between the 
two boxes during a call ? without any intermediate server (Redis DB …)

>
> Thank you
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users


___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Media server communication with OpenSIPS

2022-12-28 Thread Wadii ELMAJDI | Evenmedia
Hello,

I must send more data than just a hangup code:  a duration,  a text value..
X-Asterisk-HangupCauseCode is only sent when a called is hung up after being 
answered. Plus, it isn’t really a custom header. It must be an int value. Same 
for Q.850 reason header.
I will maintain my current solution then (the in-dialog request via mi_http)

Thank you


De : Users  De la part de Brett Nemeroff
Envoyé : mardi 27 décembre 2022 16:18
À : OpenSIPS users mailling list 
Objet : Re: [OpenSIPS-Users] Media server communication with OpenSIPS

If your UAC doesn't have the capabilities of sending it in the BYE or an 
in-dialog request, then you'll have to do something out of band like HTTPS, 
Redis, etc, which are not bad options. Have you looked into 
"X-Asterisk-HangupCauseCode" to see if that can help you out?


On Tue, Dec 27, 2022 at 8:55 AM Wadii ELMAJDI | Evenmedia 
mailto:wa...@evenmedia.fr>> wrote:
>
> Hello,
>
>
> I am using Asterisk as a media server behind OpenSIPS.
> I need to send some additional data to opensips during the call or at the 
> latest during the hangup. For instance a custom hang up reason.
> Asterisk does not allow neither to send a sequential request withing an 
> ongoing dialog, nor add headers to a BYE method.
> The current solution I’m using is pushing a dialog var (dlg_push_var) using 
> Call-ID via (mi_http), but that means I rely on a curl http request during my 
> call…
> Is there any better option for a direct communication between the two boxes 
> during a call ? without any intermediate server (Redis DB …)
>
> Thank you
>
> ___
> Users mailing list
> Users@lists.opensips.org<mailto:Users@lists.opensips.org>
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


Re: [OpenSIPS-Users] Media server communication with OpenSIPS

2022-12-27 Thread Brett Nemeroff
If your UAC doesn't have the capabilities of sending it in the BYE or an
in-dialog request, then you'll have to do something out of band like HTTPS,
Redis, etc, which are not bad options. Have you looked into
"X-Asterisk-HangupCauseCode" to see if that can help you out?


On Tue, Dec 27, 2022 at 8:55 AM Wadii ELMAJDI | Evenmedia <
wa...@evenmedia.fr> wrote:
>
> Hello,
>
>
> I am using Asterisk as a media server behind OpenSIPS.
> I need to send some additional data to opensips during the call or at the
latest during the hangup. For instance a custom hang up reason.
> Asterisk does not allow neither to send a sequential request withing an
ongoing dialog, nor add headers to a BYE method.
> The current solution I’m using is pushing a dialog var (dlg_push_var)
using Call-ID via (mi_http), but that means I rely on a curl http request
during my call…
> Is there any better option for a direct communication between the two
boxes during a call ? without any intermediate server (Redis DB …)
>
> Thank you
>
> ___
> Users mailing list
> Users@lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


[OpenSIPS-Users] Media server communication with OpenSIPS

2022-12-27 Thread Wadii ELMAJDI | Evenmedia
Hello,

I am using Asterisk as a media server behind OpenSIPS.
I need to send some additional data to opensips during the call or at the 
latest during the hangup. For instance a custom hang up reason.
Asterisk does not allow neither to send a sequential request withing an ongoing 
dialog, nor add headers to a BYE method.
The current solution I'm using is pushing a dialog var (dlg_push_var) using 
Call-ID via (mi_http), but that means I rely on a curl http request during my 
call...
Is there any better option for a direct communication between the two boxes 
during a call ? without any intermediate server (Redis DB ...)

Thank you
___
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users