Hello,
Looking for pointers as to what I'm missing here.
I'm using the presence module to allow UAs to subscribe to message-summary events. I can see the entries appearing in the active_watchers table and I see subscription renewals increment the cseq columns so I'm satisfied this part is working well.
I'm having trouble finding out how to tell Kamailio about a change to the message-summary so that it can notify the watchers.
The pua module seems to provide a way but it doesn't seem to work with the subscriptions set up by the presence module. The presence module itself does not seem to offer any RPCs capable of doing this.
Appreciate any pointers!
Thanks,
Hi Trevor,
Typically, your voicemail server would send a publish to Kamailio, which would then notify each of the watchers.
A call to handle_publish() should be all that’s required.
https://www.kamailio.org/docs/modules/stable/modules/presence.html#presence....
Cheers,
Charles
On Mon, 18 Feb 2019 at 21:07, Trevor Peirce tpeirce-lists@acrovoice.ca wrote:
Hello,
Looking for pointers as to what I'm missing here.
I'm using the presence module to allow UAs to subscribe to message-summary events. I can see the entries appearing in the active_watchers table and I see subscription renewals increment the cseq columns so I'm satisfied this part is working well.
I'm having trouble finding out how to tell Kamailio about a change to the message-summary so that it can notify the watchers.
The pua module seems to provide a way but it doesn't seem to work with the subscriptions set up by the presence module. The presence module itself does not seem to offer any RPCs capable of doing this.
Appreciate any pointers!
Thanks,
-- Trevor Peirce AcroVoice Solutions Inc
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
umm that sounds interesting: i have in my cfg file presence configured, and also configure asterisk realtime, and my led in phones does not get on and only works if i setup the phones only with asterisk!
here my configuration:
route[PRESENCE] { if(!is_method("PUBLISH|SUBSCRIBE")) { xlog("[$Tf] presence rule: not forwarding sub/pub requests??????\n"); return; }
if(is_method("SUBSCRIBE") && $hdr(Event)=="message-summary") { route(TOVOICEMAIL); # returns here if no voicemail server is configured sl_send_reply("404", "No voicemail service"); xlog("[$Tf] presence rule: not forwarding voicemail requests??????\n"); exit; }
#!ifdef WITH_PRESENCE if (!t_newtran()) { sl_reply_error(); xlog("[$Tf] presence rule: error??????\n"); exit; }
if(is_method("PUBLISH")) { handle_publish(); t_release(); } else if(is_method("SUBSCRIBE")) { handle_subscribe(); t_release(); } exit; #!endif
# if presence enabled, this part will not be executed if (is_method("PUBLISH") || $rU==$null) { sl_send_reply("404", "Not here"); xlog("[$Tf] presence rule: nothere publish requests??????\n"); exit; } return; }
Lenz McKAY Gerardo (PICCORO) http://qgqlochekone.blogspot.com
El lun., 18 de feb. de 2019 a la(s) 17:48, Charles Chance (charles.chance@sipcentric.com) escribió:
Hi Trevor,
Typically, your voicemail server would send a publish to Kamailio, which would then notify each of the watchers.
A call to handle_publish() should be all that’s required.
https://www.kamailio.org/docs/modules/stable/modules/presence.html#presence....
Cheers,
Charles
On Mon, 18 Feb 2019 at 21:07, Trevor Peirce tpeirce-lists@acrovoice.ca wrote:
Hello,
Looking for pointers as to what I'm missing here.
I'm using the presence module to allow UAs to subscribe to message-summary events. I can see the entries appearing in the active_watchers table and I see subscription renewals increment the cseq columns so I'm satisfied this part is working well.
I'm having trouble finding out how to tell Kamailio about a change to the message-summary so that it can notify the watchers.
The pua module seems to provide a way but it doesn't seem to work with the subscriptions set up by the presence module. The presence module itself does not seem to offer any RPCs capable of doing this.
Appreciate any pointers!
Thanks,
-- Trevor Peirce AcroVoice Solutions Inc
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Charles Chance Managing Director
t. 0330 120 1200 m. 07932 063 891
Sipcentric Ltd. Company registered in England & Wales no. 7365592. Registered office: Faraday Wharf, Innovation Birmingham Campus, Holt Street, Birmingham Science Park, Birmingham B7 4BB. _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
On 18/02/2019 1:47 p.m., Charles Chance wrote:
Typically, your voicemail server would send a publish to Kamailio, which would then notify each of the watchers.
A call to handle_publish() should be all that’s required.
Thanks Charles, unfortunately I am not using a voicemail server that would understand how to do that, so I'd have to generate it myself.
An RPC would be the easiest way but if that is not possible I can generate the PUBLISH myself. I'd just prefer to avoid dealing with SIP directly for this purpose if possible.
Thanks,
On Monday, February 18, 2019 3:06:32 PM CST Trevor Peirce wrote:
Hello,
Looking for pointers as to what I'm missing here.
I'm using the presence module to allow UAs to subscribe to message-summary events. I can see the entries appearing in the active_watchers table and I see subscription renewals increment the cseq columns so I'm satisfied this part is working well.
I'm having trouble finding out how to tell Kamailio about a change to the message-summary so that it can notify the watchers.
The pua module seems to provide a way but it doesn't seem to work with the subscriptions set up by the presence module. The presence module itself does not seem to offer any RPCs capable of doing this.
Appreciate any pointers!
I use the following Python3 script with Asterisk 16 since it won't publish MWI natively to Kamailio (yet)
### voicemail.conf externnotify=/usr/bin/asterisk-kamailio-publish-mwi
### asterisk-kamailio-publish-mwi #!/usr/bin/python3 # -*- coding: utf-8 -*-
import argparse import requests
# http://kamailio.org/docs/modules/stable/modules/jsonrpcs KAMAILIO_RPC_URL = 'http://<KAMAILIO IP>:5060/RPC' SIP_NEXTHOP = 'sip:127.0.0.1:5060' SIP_DOMAIN = 'example.com'
class ExternNotifyHandler:
def __init__(self, context, exten, new, old, urgent): """ Parse context, extension, and new, old, and urgent message counts
"""
self.context = context if context == 'default': self.context = SIP_DOMAIN
self.exten = exten
self.recipient = ("sip:{}@{}").format(self.exten, self.context)
self.waiting = 'no' if new > 0: self.waiting = 'yes'
self.body = ("Messages-Waiting: {}\r\n" "Message-Account: {}\r\n" "Voice-Message: {:d}/{:d} ({:d}/0)\r\n").format( self.waiting, self.recipient, new, old, urgent)
def kamailio_rpc_sip_publish(self): """ Generate a SIP PUBLISH MWI via Kamailio's jsonrpcs module """ headers = ("From: <{0}>\r\n" "To: <{0}>\r\n" "Max-Forwards: 1\r\n" "Event: message-summary\r\n" "Content-Type: application/simple-message-summary; " "charset=utf-8\r\n").format(self.recipient)
content = { 'id': 1, 'jsonrpc': '2.0', 'method': 'tm.t_uac_start', 'params': [ 'PUBLISH', self.recipient, SIP_NEXTHOP, '.', headers, self.body ] }
# http://docs.python-requests.org/en/latest/user/quickstart/ try: r = requests.post(KAMAILIO_RPC_URL, allow_redirects=False, json=content, timeout=5) r.raise_for_status() except requests.exceptions.ConnectionError as e: print(e) pass except requests.exceptions.RequestException as e: print(e) pass
# Main processing if __name__ == "__main__": """ Parse Asterisk VoiceMail externnotify positional command line arguments context, extension, new voicemails, old voicemails, urgent voicemails """ parser = argparse.ArgumentParser() parser.add_argument('context', help='Voicemail context') parser.add_argument('exten', help='Voicemail extension') parser.add_argument('new', type=int, help='New voicemail count') parser.add_argument('old', type=int, help='Old voicemail count') parser.add_argument('urgent', type=int, help='Urgent voicemail count') args = parser.parse_args()
p = ExternNotifyHandler(args.context, args.exten, args.new, args.old, args.urgent)
p.kamailio_rpc_sip_publish()
On 18/02/2019 2:56 p.m., Anthony Joseph Messina wrote:
I use the following Python3 script with Asterisk 16 since it won't publish MWI natively to Kamailio (yet)
Hi Anthony,
Thanks so much! The example you provided led me in the right direction. I've made use of XML_RPC (rather than JSON) using this same approach and have successfully managed to set my softphone to show that there are new messages.
Best regards,