[OpenSIPS-Users] opensips 2.2 generate NOTIFY with status=available

Răzvan Crainea razvan at opensips.org
Thu Oct 12 06:45:28 EDT 2017


Hi, Jonathan!

Your alternative works too. If you want to use the previous version, you 
can use the + operator to concatenet strings:

$avp(test) = "<?xml... entity=\"" + $avp(test) + "\"> ...";

Best regards,

Răzvan Crainea
OpenSIPS Developer
www.opensips-solutions.com

On 10/11/2017 11:36 PM, Jonathan Hunter wrote:
>
> Sorry guys, spam will stop now!
>
>
> Found an alternative method which works;
>
>
> search_append_body("</tuple>", " <note 
> xmlns=\"urn:ietf:params:xml:ns:pidf\"> available </note><dm:person 
> xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" 
> xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" id=\"pers_mixingid\"> 
> <dm:note> available </dm:note> </dm:person>");
>
>
> Thanks!
>
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* 11 October 2017 19:34
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] opensips 2.2 generate NOTIFY with 
> status=available
> Hi Guys,
>
> Almost have this working, where I replace a NOTIFY message and then 
> send it on for presence.
>
> The remaining issue is populating the entity value using an AVP as 
> below, it just adds it as entity="$avp(test)" and not the value of it.
>
>
> $avp(test) = "sip:" + $fU + "@" + $fd;
>
> $avp(newbody) = "<?xml version=\"1.0\" ?> <presence 
> xmlns=\"urn:ietf:params:xml:ns:pidf\" *entity=\"$avp(test)\"> *<tuple 
> xmlns=\"urn:ietf:params:xml:ns:pidf\" id=\"tuple_mixingid\"> <status> 
> <basic> open </basic> </status> </tuple> <note 
> xmlns=\"urn:ietf:params:xml:ns:pidf\"> available </note><dm:person 
> xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" 
> xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" id=\"pers_mixingid\"> 
> <dm:note> available </dm:note> </dm:person> </presence>";
> add_body("$avp(newbody)");
>
>
> Can anyone advise as to how I can escape the $avp(test) so its value 
> is populated?
>
> Thanks!
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* 10 October 2017 20:20
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] opensips 2.2 generate NOTIFY with 
> status=available
>
> Hi Răzvan,
>
>
> Sorry another follow up question.
>
>
> Say I want to remove the body of the NOTIFY and add the below;
>
>
> Message Body
>     eXtensible Markup Language
>         <?xml
>             version="1.0"
>             ?>
>         <presence
>             xmlns="urn:ietf:params:xml:ns:pidf"
>             entity="sip:2002 at sip.co.uk">
>             <tuple
> xmlns="urn:ietf:params:xml:ns:pidf"
>                 id="tuple_mixingid">
>                 <status>
>                     <basic>
>                         open
>                         </basic>
>                     </status>
>                 </tuple>
>                <dm:note>
>                     Available
>                     </dm:note>
>                 </presence>
>
> Can I do this with add_body ? And if so what syntax/ carrier breaks 
> would be required so it will parse? As I have had issues trying to add 
> multiple lines to commands before and cant see it documented, if it is 
> please point me in the direction.
>
>
> Many thanks!
>
>
> Jon
>
>
>
>
> ------------------------------------------------------------------------
> *From:* Jonathan Hunter <hunterj91 at hotmail.com>
> *Sent:* 09 October 2017 09:39
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] opensips 2.2 generate NOTIFY with 
> status=available
> Hi Răzvan,
>
> Hope you are well? Thank you so much for the response.
>
> Essentially we are testing opensips with a third-party receptionist 
> console and I have configured presence.  Now it works perfectly when 
> there are calls in progress, and handsets, in particular yealink, and 
> bria soft-clients are on the phone.
>
> The receptionist sends SUBSCRIBE, and opensips responds with this 
> contained within the Message body;
>
>
> Message Body
>     eXtensible Markup Language
>         <?xml
>         <presence
> xmlns="urn:ietf:params:xml:ns:pidf"
> entity="sip:2002 at siproxy.co.uk">
>             <tuple
> xmlns="urn:ietf:params:xml:ns:pidf"
>                 id="tuple_mixingid">
>                 <status>
>                     <basic>
>                         open
>                         </basic>
>                     </status>
>                 </tuple>
>             <note
>             <dm:person
> xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
> xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"
>                 id="pers_mixingid">
>                 <rpid:activities>
> <rpid:on-the-phone/>
> </rpid:activities>
>                 <dm:note>
>                     Proceeding
>                     </dm:note>
>                 </dm:person>
>             </presence>
>
>
> Now my problem specifically is letting the console know when a user is 
> online and available, as when it sends a subscribe, in this case to 
> monitor extension 2002, which is registered, it gets back;
>
> Message Body
>     eXtensible Markup Language
>         <?xml
>         <presence
> xmlns="urn:ietf:params:xml:ns:pidf"
> entity="sip:2002 at siproxy.co.uk">
>             <tuple
> xmlns="urn:ietf:params:xml:ns:pidf"
>                 id="tuple_mixingid">
>                 <status>
>                     <basic>
>                         closed
>                         </basic>
>                     </status>
>                 </tuple>
>             </presence>
>
>
> I would ideally like to send status=open and 
> <dm:note>Available</dm:note> if a user is registered and available, is 
> this possible or do I need to manipulate the body as you originally 
> suggested?
>
> As this will then let the console display the user as green and 
> available! :)
>
> Many thanks!
>
> Jon
>
>
>
> ------------------------------------------------------------------------
> *From:* Users <users-bounces at lists.opensips.org> on behalf of Răzvan 
> Crainea <razvan at opensips.org>
> *Sent:* 09 October 2017 09:18
> *To:* users at lists.opensips.org
> *Subject:* Re: [OpenSIPS-Users] opensips 2.2 generate NOTIFY with 
> status=available
> Hi, Jonathan!
>
> A quick and blind answer is to catch the NOTIFY messages in 
> local_route and change them as you want using regular expressions on 
> the message body.
>
> Perhaps I can offer a more elegant solution for this issue if you are 
> a bit more explicit about what kind of events are you generating 
> presence for, and when is this NOTIFY message sent?
>
> Best regards,
> Răzvan Crainea
> OpenSIPS Developer
> www.opensips-solutions.com
> Home — OpenSIPS Solutions <http://www.opensips-solutions.com/>
> www.opensips-solutions.com
> OpenSIPS is a mature Open Source implementation of a SIP server. 
> OpenSIPS is more than a SIP proxy/router as it includes 
> application-level functionalities.
>
>
> On 10/05/2017 09:15 PM, Jonathan Hunter wrote:
>> Hi Guys,
>>
>> I am using opensips 2.2 and the presence modules to generate PUBLISH 
>> and NOTIFY messages.
>>
>> I can see with the NOTIFY message opensips is sending a 
>> status=closed, can I make it send a status=available if the extension 
>> is registered and ready for calls?
>>
>> Many thanks
>>
>> Jon
>>
>>
>> Session Initiation Protocol (NOTIFY)
>>     Request-Line: NOTIFY sip:SIPWATCHER:5063 SIP/2.0
>>     Message Header
>>     Message Body
>>         eXtensible Markup Language
>>             <?xml
>>             <presence
>> xmlns="urn:ietf:params:xml:ns:pidf"
>> entity="sip:2002 at SIPDOMAIN">
>>                 <tuple
>> xmlns="urn:ietf:params:xml:ns:pidf"
>> id="tuple_mixingid">
>> <status>
>> <basic>
>> closed
>> </basic>
>> </status>
>> </tuple>
>>                 </presence>
>>
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20171012/5a3747b2/attachment-0001.html>


More information about the Users mailing list