[SR-Users] Presence publish manipulation

Gertjan Wolzak g.wolzak at kazlow.nl
Wed Jun 26 15:34:24 CEST 2019


Hello Kamailions,

I'm running into the following challenge.

A kamailio setup where phones register with their mac address as uid and 
a password.

Users have to login to the system by dialing a special number where they 
have to enter their internal extension and a pin code.

Now the system knows which extension(number) is logged in on which 
phone(macaddress). This is done with from updates, just a type of 
hotdesking.

Now I want to  use presence....

When a phone makes a phone call, kamailio generates a publish message 
where the "local" part of the xml code contains the mac address.

How can I manipulate the Publish xml information? I mean the 
manipulation can be done with textops, but which variables to use and 
where in the configuration?

Im asking because when I disable the presence route and do not call it 
in my configuration, but with presence enabled, I still get Publish 
messages....

I have tried adding a Sender header which contains the "extension" of 
the phone and then call the publish in the PRESENCE route like this: 
handle_publish("$hdr(Sender)");

But this does not change the xml information.

Am I doing things wrong?

Below the first publish message that is send, where 10.88.77.172 is the 
kamailio server.

U 2019/06/26 14:54:37.233345 10.88.77.172:5060 -> 10.88.77.172:5060 #7
PUBLISH sip:0015659a9931 at 10.88.77.172:5060 SIP/2.0.
Via: SIP/2.0/UDP 
10.88.77.172;branch=z9hG4bK1a87.5510d093000000000000000000000000.0.
To: <sip:0015659a9931 at 10.88.77.172:5060>.
From: 
<sip:0015659a9931 at 10.88.77.172:5060>;tag=a2652bb825a097f3b7285d4c70edd51a-5c5d.
CSeq: 10 PUBLISH.
Call-ID: 173009c21f4e3c77-94480 at 10.88.77.172.
Content-Length: 579.
User-Agent: kamailio (5.1.8 (x86_64/linux)).
Max-Forwards: 70.
Event: dialog.
Expires: 125.
Content-Type: application/dialog-info+xml.
.
<?xml version="1.0"?>
<dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info" version="0" 
state="full" entity="sip:0015659a9931 at 10.88.77.172:5060">
   <dialog id="0_2285997339 at 10.88.77.184" 
call-id="0_2285997339 at 10.88.77.184" direction="initiator">
     <state>Trying</state>
     <remote>
       <identity>sip:604113 at 10.88.77.172:5060</identity>
       <target uri="sip:604113 at 10.88.77.172:5060"/>
     </remote>
     <local>
       <identity>sip:0015659a9931 at 10.88.77.172:5060</identity>
       <target uri="sip:0015659a9931 at 10.88.77.172:5060"/>
     </local>
   </dialog>
</dialog-info>


I would like to change the local identity and target uri into the 
extension assigned to that phone, for example 604114....

So that subscribers to the extension 604114 get informed about the state 
of the phone with the used uid 0015659a9931.

Feedback would be appricated. Pointers to where I am going wrong as 
well, ... that's feedback too.

Rgds,

Gertjan














More information about the sr-users mailing list