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 <[email protected]>
*Sent:* 11 October 2017 19:34
*To:* [email protected]
*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 <[email protected]>
*Sent:* 10 October 2017 20:20
*To:* [email protected]
*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:[email protected]">
            <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 <[email protected]>
*Sent:* 09 October 2017 09:39
*To:* [email protected]
*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:[email protected]">
            <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:[email protected]">
            <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 <[email protected]> on behalf of Răzvan Crainea <[email protected]>
*Sent:* 09 October 2017 09:18
*To:* [email protected]
*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@SIPDOMAIN">
                <tuple
xmlns="urn:ietf:params:xml:ns:pidf"
id="tuple_mixingid">
<status>
<basic>
closed
</basic>
</status>
</tuple>
                </presence>




_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users



_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to