How to setup chat and short file transfer using MESSAGE Request Method

From Yate Documentation
(Difference between revisions)
Jump to: navigation, search
(The flow of the messages in Yate)
(The flow of the messages in Yate)
Line 75: Line 75:
 
* [[Regfile| Regfile module]]
 
* [[Regfile| Regfile module]]
 
* [[SIP Configuration File]]
 
* [[SIP Configuration File]]
 +
* [[How To's]]

Revision as of 14:09, 29 May 2013

This example allows chat and short files transfer between Twinkle clients using MESSAGE Request Method.

A MESSAGE request method transports instant messages using SIP.

Configuration

regexroute.conf:

[extra]
sip.message=120
sip.publish=120
msg.route=25
msg.execute=90

[sip.message]
${xsip_type}^$=415
.*=echo Got SIP MESSAGE type '${xsip_type}' ${xsip_body_encoding} from '${username}': ${xsip_body}
.*=enqueue msg.execute;caller=${caller};called=${called};\
 domain=${domain};callto=lateroute/${called};\
 body_encoding=${xsip_body_encoding};type=${xsip_type};text=${xsip_body}
.*=200
  
[sip.publish]
${xsip_type}^application/pidf+xml$^=415
${xsip_body}<status><basic>\(.*\)</basic></status>=echo Got SIP PRESENCE from '${username}': \1
.*=200
[msg.route]
.*=rename call.route;message=msg.route

[msg.execute]
${callto}^sip/\(sip:.*\)$=rename xsip.generate;\
method=MESSAGE;uri=\1;sip_From=<sip:${caller}@${domain$nosuch.dom}>;\
xsip_type=${type$text/plain};xsip_body_encoding=${body_encoding};\
xsip_body=${text};connection_id=${oconnection_id}


In ysipchan.conf:

[general]
maxpkt=4096
generate=yes

[methods]
message=yes
publish=yes

To configure twinkle clients, register users in regfile.conf:

[123]
password=mypass123

[234]
password=mypass234

The flow of the messages in Yate

Yate receives a MESSAGE SIP Request. This will be handled generically, so a Yate message named sip.message will be sent.

  • Regexroute receives this message:
    • If xsip_type parameter is not set a 415 error code will be returned in SIP module, otherwise echo a message for debug purpose.
    • Enqueue msg.execute message in which we'll copy the parameters defining message: caller, called, domain, callto, body_encoding, type, text. In order to deliver the message we have to find the URI for the receiving end, and for that we use lateroute. Set callto=lateroute/${called}.
    • Handle message and return code 200 OK.
  • Lateroute module receives the msg.execute message and sends msg.route message with called parameter the ${called} from above
  • Regexroute receives msg.route and renames it to call.route
  • Another module(regfile in current setup) handles call.route and returns the uri for which we need to deliver the received chat message.
  • Lateroute replaces callto parameter with the returned value of the call.route message and leaves msg.execute unhandled
  • msg.execute is received in regexroute and is renamed to xsip.generate if callto param is a valid SIP uri.
  • xsip.generate will be handled by ysipchan module that will finish delivering the chat message


See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers