Module: kamailio
Branch: master
Commit: 4b3a7d37ce9d91bcd0367712de5ca1f2668eaebe
URL:
https://github.com/kamailio/kamailio/commit/4b3a7d37ce9d91bcd0367712de5ca1f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-08-31T11:14:27+02:00
sipjson: added options to serialize To and CSeq attributes
- c and t mode options
---
Modified: src/modules/sipjson/sipjson_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4b3a7d37ce9d91bcd0367712de5ca1f…
Patch:
https://github.com/kamailio/kamailio/commit/4b3a7d37ce9d91bcd0367712de5ca1f…
---
diff --git a/src/modules/sipjson/sipjson_mod.c b/src/modules/sipjson/sipjson_mod.c
index ca6ea8e8bd..e2798332f0 100644
--- a/src/modules/sipjson/sipjson_mod.c
+++ b/src/modules/sipjson/sipjson_mod.c
@@ -345,6 +345,26 @@ static int sj_serialize_data(sip_msg_t* msg, srjson_doc_t *jdoc, str*
smode)
srjson_AddStrStrToObject(jdoc, jr, "rb", 2, s.s, s.len);
}
break;
+ case 'c':
+ if(msg->cseq==NULL && ((parse_headers(msg, HDR_CSEQ_F, 0)==-1)
+ || (msg->cseq==NULL)) ) {
+ s.s = "";
+ s.len = 0;
+ } else {
+ s = get_cseq(msg)->number;
+ }
+ srjson_AddStrStrToObject(jdoc, jr, "cs", 2, s.s, s.len);
+ break;
+ case 't':
+ puri = parse_to_uri(msg);
+ if(puri==NULL) {
+ srjson_AddStrStrToObject(jdoc, jr, "tU", 2, "", 0);
+ srjson_AddStrStrToObject(jdoc, jr, "td", 2, "", 0);
+ } else {
+ sj_add_xuri_attr(puri, 1, "tU", 2, jdoc, jr);
+ sj_add_xuri_attr(puri, 2, "td", 2, jdoc, jr);
+ }
+ break;
}
}
return 1;