Skip to content

Commit

Permalink
Merge pull request #582 from eschmidbauer/new-module/nsq
Browse files Browse the repository at this point in the history
New Module, NSQ
  • Loading branch information
Emmanuel Schmidbauer committed Apr 26, 2016
2 parents 14e0f68 + 8ef73bd commit 0f2fddb
Show file tree
Hide file tree
Showing 19 changed files with 3,689 additions and 0 deletions.
23 changes: 23 additions & 0 deletions modules/nsq/Makefile
@@ -0,0 +1,23 @@
# $Id: $
#
# NSQ
#
#
# WARNING: do not run this directly, it should be run by the master Makefile

include ../../Makefile.defs

auto_gen=
NAME=nsq.so

LIBS=-lnsq -lev -levbuffsock -lcurl -ljson-c
DEFS+=-I$(LOCALBASE)/include -I/usr/local/include $(shell pkg-config --cflags json-c)

DEFS+=-DKAMAILIO_MOD_INTERFACE

SERLIBPATH=../../lib
SER_LIBS=$(SERLIBPATH)/srdb2/srdb2 $(SERLIBPATH)/srdb1/srdb1
SER_LIBS+=$(SERLIBPATH)/kmi/kmi
SER_LIBS+=$(SERLIBPATH)/kcore/kcore

include ../../Makefile.modules
106 changes: 106 additions & 0 deletions modules/nsq/defs.h
@@ -0,0 +1,106 @@
/*
* defs.h
*
*/

#ifndef _NSQ_DEFS_H_
#define _NSQ_DEFS_H_

#define BLF_MAX_DIALOGS 8
#define BLF_JSON_PRES "Presentity"
#define BLF_JSON_PRES_USER "Presentity-User"
#define BLF_JSON_PRES_REALM "Presentity-Realm"
#define BLF_JSON_FROM "From"
#define BLF_JSON_FROM_USER "From-User"
#define BLF_JSON_FROM_REALM "From-Realm"
#define BLF_JSON_FROM_URI "From-URI"
#define BLF_JSON_TO "To"
#define BLF_JSON_TO_USER "To-User"
#define BLF_JSON_TO_REALM "To-Realm"
#define BLF_JSON_TO_URI "To-URI"
#define BLF_JSON_CALLID "Call-ID"
#define BLF_JSON_TOTAG "To-Tag"
#define BLF_JSON_FROMTAG "From-Tag"
#define BLF_JSON_STATE "State"
#define BLF_JSON_USER "User"
#define BLF_JSON_QUEUE "Queue"
#define BLF_JSON_EXPIRES "Expires"
#define BLF_JSON_APP_NAME "App-Name"
#define BLF_JSON_APP_VERSION "App-Version"
#define BLF_JSON_NODE "Node"
#define BLF_JSON_SERVERID "Server-ID"
#define BLF_JSON_EVENT_CATEGORY "Event-Category"
#define BLF_JSON_EVENT_NAME "Event-Name"
#define BLF_JSON_TYPE "Type"
#define BLF_JSON_MSG_ID "Msg-ID"
#define BLF_JSON_DIRECTION "Direction"

#define BLF_JSON_CONTACT "Contact"
#define BLF_JSON_EVENT_PKG "Event-Package"
#define MWI_JSON_WAITING "Messages-Waiting"
#define MWI_JSON_NEW "Messages-New"
#define MWI_JSON_SAVED "Messages-Saved"
#define MWI_JSON_URGENT "Messages-Urgent"
#define MWI_JSON_URGENT_SAVED "Messages-Urgent-Saved"
#define MWI_JSON_ACCOUNT "Message-Account"
#define MWI_JSON_FROM "From"
#define MWI_JSON_TO "To"

#define DIALOGINFO_BODY_BUFFER_SIZE 8192
#define MWI_BODY_BUFFER_SIZE 2048
#define PRESENCE_BODY_BUFFER_SIZE 4096

#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\"> \
<tuple xmlns=\"urn:ietf:params:xml:ns:pidf\" id=\"%s\">\
<status>\
<basic>%s</basic>\
</status>\
</tuple>\
<note xmlns=\"urn:ietf:params:xml:ns:pidf\">%s</note>\
<dm:person xmlns:dm=\"urn:ietf:params:xml:ns:pidf:data-model\" xmlns:rpid=\"urn:ietf:params:xml:ns:pidf:rpid\" id=\"1\">\
<rpid:activities>%s</rpid:activities>\
<dm:note>%s</dm:note>\
</dm:person>\
</presence>"

#define DIALOGINFO_EMPTY_BODY "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"%.*s\"> \
<dialog call-id=\"76001e23e09704ea9e1257ebea85e1f3\" direction=\"initiator\">\
<state>terminated</state>\
</dialog>\
</dialog-info>"

#define LOCAL_TAG "local-tag=\"%.*s\""
#define REMOTE_TAG "remote-tag=\"%.*s\""

#define DIALOGINFO_BODY "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"%.*s\">\
<dialog id=\"%.*s\" call-id=\"%.*s\" %.*s %.*s direction=\"%.*s\">\
<state>%.*s</state>\
<local>\
<identity display=\"%.*s\">%.*s</identity>\
<target uri=\"%.*s\"/>\
</local>\
<remote>\
<identity display=\"%.*s\">%.*s</identity>\
<target uri=\"%.*s\"/>\
</remote>\
</dialog>\
</dialog-info>"

#define DIALOGINFO_BODY_2 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" version=\"1\" state=\"full\" entity=\"%.*s\">\
<dialog id=\"%.*s\" call-id=\"%.*s\" %.*s %.*s direction=\"%.*s\">\
<state>%.*s</state>\
<local>\
<identity display=\"%.*s\">%.*s</identity>\
</local>\
<remote>\
<identity display=\"%.*s\">%.*s</identity>\
</remote>\
</dialog>\
</dialog-info>"

#endif /* _NSQ_DEFS_H_ */
4 changes: 4 additions & 0 deletions modules/nsq/doc/Makefile
@@ -0,0 +1,4 @@
docs = nsq.xml

docbook_dir = ../../../docbook
include $(docbook_dir)/Makefile.module
37 changes: 37 additions & 0 deletions modules/nsq/doc/nsq.xml
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;

]>

<book xmlns:xi="http://www.w3.org/2001/XInclude">
<bookinfo>
<title>NSQ Module</title>
<productname class="trade">&kamailioname;</productname>
<authorgroup>
<author>
<firstname>Weave Communications</firstname>
<email>comm@getweave.com</email>
</author>
<editor>
<firstname>Emmanuel</firstname>
<surname>Schmidbauer</surname>
<email>emmanuel@getweave.com</email>
</editor>
</authorgroup>
<copyright>
<year>2016</year>
<holder>Weave Communications</holder>
</copyright>
</bookinfo>
<toc></toc>

<xi:include href="nsq_admin.xml"/>
<!-- <xi:include href="db_text_devel.xml"/> -->


</book>

0 comments on commit 0f2fddb

Please sign in to comment.