This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
kamailio:k43-async-sip-routing-nodejs [2015/09/07 12:16] – [Async SIP Routing with Kamailio and Node.js] admin | kamailio:k43-async-sip-routing-nodejs [2015/09/07 12:49] – [Node.js Application] admin | ||
---|---|---|---|
Line 22: | Line 22: | ||
The tutorial here is aiming to offer a basic example, which should help building more complex external applications for deciding the SIP routing to be performed by Kamailio. | The tutorial here is aiming to offer a basic example, which should help building more complex external applications for deciding the SIP routing to be performed by Kamailio. | ||
+ | ==== RTJSON Routing Document ==== | ||
+ | |||
+ | The structure for RTJSON routing document is detailed at: | ||
+ | |||
+ | * [[http:// | ||
+ | |||
+ | Next is a partial example, with the attributes for one destination: | ||
+ | |||
+ | <code javascript> | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | [ | ||
+ | { | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | }, | ||
+ | " | ||
+ | " | ||
+ | " | ||
+ | }, | ||
+ | ... | ||
+ | ] | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | The **routing** field specify if Kamailio has to do serial or parallel forking. After that, the relevant routing information is an array of destinations stored in **routes** field. | ||
+ | |||
+ | Each destination corresponds to a SIP branch that is going to be created by Kamailio. For each branch can be specified values to set: | ||
+ | |||
+ | * request uri | ||
+ | * outbound proxy address (dst uri) | ||
+ | * display name and uri for From/To headers | ||
+ | * extra headers | ||
+ | * retransmission and ringing timeouts | ||
+ | * local socket or the path to be followed | ||
+ | * branch flags | ||
+ | |||
+ | The example above results in: the request will be routed to sip: | ||
+ | ===== Presentations ===== | ||
+ | |||
+ | The presentation at Cluecon 2015 by Daniel-Constantin Mierla includes content about this tutorial: | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
===== Kamailio Config File ===== | ===== Kamailio Config File ===== | ||
Line 38: | Line 96: | ||
* add the routing blocks specific for evapi module | * add the routing blocks specific for evapi module | ||
* use jansson to investigate returned JSON document and take decision of what to do | * use jansson to investigate returned JSON document and take decision of what to do | ||
+ | |||
+ | ==== Config Diff ==== | ||
The diff of the config file comparing with the default one: | The diff of the config file comparing with the default one: | ||
Line 158: | Line 218: | ||
</ | </ | ||
+ | |||
+ | ==== Full Config ==== | ||
The full config file is: | The full config file is: | ||
Line 875: | Line 937: | ||
* http:// | * http:// | ||
- | A simple sample application is shown next: | + | A simple sample application is shown next example. It connects to Kamailio' |
- | < | + | To read more about nestring format, see: |
+ | |||
+ | * https:// | ||
+ | |||
+ | Node.js application: | ||
+ | |||
+ | < | ||
var net = require(' | var net = require(' | ||
Line 1007: | Line 1075: | ||
</ | </ | ||
+ | ===== Resources ===== | ||
+ | |||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * [[https:// |