[sr-dev] git:master:c5b79b55: nsq: fix MWI NOTIFY with 0 Voice Messages
Emmanuel Schmidbauer
emmanuel at getweave.com
Thu May 12 18:08:06 CEST 2016
Module: kamailio
Branch: master
Commit: c5b79b55f2f0cdaf7f99e5f0d8042ba6435b98c8
URL: https://github.com/kamailio/kamailio/commit/c5b79b55f2f0cdaf7f99e5f0d8042ba6435b98c8
Author: Emmanuel Schmidbauer <emmanuel at getweave.com>
Committer: Emmanuel Schmidbauer <emmanuel at getweave.com>
Date: 2016-05-12T12:07:59-04:00
nsq: fix MWI NOTIFY with 0 Voice Messages
---
Modified: modules/nsq/defs.h
Modified: modules/nsq/nsq_pua.c
---
Diff: https://github.com/kamailio/kamailio/commit/c5b79b55f2f0cdaf7f99e5f0d8042ba6435b98c8.diff
Patch: https://github.com/kamailio/kamailio/commit/c5b79b55f2f0cdaf7f99e5f0d8042ba6435b98c8.patch
---
diff --git a/modules/nsq/defs.h b/modules/nsq/defs.h
index 0f479c1..68ab9e7 100644
--- a/modules/nsq/defs.h
+++ b/modules/nsq/defs.h
@@ -79,6 +79,7 @@
#define PRESENCE_BODY_BUFFER_SIZE 4096
#define MWI_BODY_VOICE_MESSAGE "Messages-Waiting: %.*s\r\nMessage-Account: %.*s\r\nVoice-Message: %.*s\r\n"
+#define MWI_BODY_NO_VOICE_MESSAGE "Messages-Waiting: %.*s\r\nMessage-Account: %.*s\r\n"
#define MWI_BODY "Messages-Waiting: %.*s\r\nMessage-Account: %.*s\r\nVoice-Message: %.*s/%.*s (%.*s/%.*s)\r\n"
#define PRESENCE_BODY "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" xmlns:c=\"urn:ietf:params:xml:ns:pidf:cipid\" entity=\"%s\"> \
diff --git a/modules/nsq/nsq_pua.c b/modules/nsq/nsq_pua.c
index 005d094..f16b352 100644
--- a/modules/nsq/nsq_pua.c
+++ b/modules/nsq/nsq_pua.c
@@ -327,14 +327,17 @@ int nsq_pua_publish_mwi_to_presentity(struct json_object *json_obj) {
expires += (int)time(NULL);
}
- if (mwi_voice_message.len > 0) {
- sprintf(body, MWI_BODY_VOICE_MESSAGE, mwi_waiting.len, mwi_waiting.s,
- mwi_account.len, mwi_account.s, mwi_voice_message.len, mwi_voice_message.s);
- } else {
+ if (mwi_new.len > 0)
sprintf(body, MWI_BODY, mwi_waiting.len, mwi_waiting.s,
mwi_account.len, mwi_account.s, mwi_new.len, mwi_new.s,
mwi_saved.len, mwi_saved.s, mwi_urgent.len, mwi_urgent.s,
mwi_urgent_saved.len, mwi_urgent_saved.s);
+ } else if (mwi_voice_message.len > 0) {
+ sprintf(body, MWI_BODY_VOICE_MESSAGE, mwi_waiting.len, mwi_waiting.s,
+ mwi_account.len, mwi_account.s, mwi_voice_message.len, mwi_voice_message.s);
+ } else {
+ sprintf(body, MWI_BODY_NO_VOICE_MESSAGE, mwi_waiting.len, mwi_waiting.s,
+ mwi_account.len, mwi_account.s);
}
mwi_body.s = body;
More information about the sr-dev
mailing list