Transcript
Page 1: Developing SIP Applications

© Voxeo Corporation

Sep 16th, 2008

TMC Communication Developer Conference

RJ [email protected]

Developing SIP Applications

Page 2: Developing SIP Applications

© Voxeo Corporation

Telephony

Page 3: Developing SIP Applications

© Voxeo Corporation - Confidential

Sucks

Page 4: Developing SIP Applications

© Voxeo Corporation

Complex

Page 5: Developing SIP Applications

© Voxeo Corporation

Arcane

Page 6: Developing SIP Applications

© Voxeo Corporation

Proprietary

Page 7: Developing SIP Applications

© Voxeo Corporation

This is not how it should be...

Page 8: Developing SIP Applications

© Voxeo Corporation

Simple

Page 9: Developing SIP Applications

© Voxeo Corporation

Ubiquitous

Page 10: Developing SIP Applications

© Voxeo Corporation

Open

Page 11: Developing SIP Applications

© Voxeo Corporation

What to do?

Page 12: Developing SIP Applications

© Voxeo Corporation

Leverage The Web Model

Page 13: Developing SIP Applications

© Voxeo Corporation

Utilize Standards

Page 14: Developing SIP Applications

© Voxeo Corporation - Confidential

SOAP/REST

Page 15: Developing SIP Applications

© Voxeo Corporation

What Does It Look Like?

Page 16: Developing SIP Applications

© Voxeo Corporation16

Application

Platform

API XML Tools

Page 17: Developing SIP Applications

© Voxeo Corporation17

Application

Prophecy

JSR289, REST, SOAP

CCXML&

VoiceXMLDesigner

Page 18: Developing SIP Applications

© Voxeo Corporation18

ApplicationApplication

Platform

API XML Tools

Page 19: Developing SIP Applications

© Voxeo Corporation

Building Blocks

Page 20: Developing SIP Applications

© Voxeo Corporation

Session Initiation Protocol

- Session Initiation Protocol (SIP)defines how to establish a communication session betweentwo endpoints

- Primarily used for voice, but can for IM or virtually any other protocol

- Almost always used in client/server configuration with "SIP proxies" in control of "SIP endpoints"- Work going on in P2PSIP - see www.p2psip.org

- Text-based protocol, originally modeled on HTTP

Page 21: Developing SIP Applications

© Voxeo Corporation

SIP Communication

Alice Bob

RTP (voice)

INVITE

180 RINGING200 OK

ACK

BYE200 OK

Page 22: Developing SIP Applications

© Voxeo Corporation

Alice Bob

ProxyA

ProxyBSIP

SIP

RTP

SIP

Page 23: Developing SIP Applications

© Voxeo Corporation

SIP Resources

- Internet Engineering Task Force (IETF)- RFC 3261- Hitchhiker’s Guide to SIP

- Open Source Info- VoIP Info Wiki: www.voip-info.org

- Industry Sites- SIP Forum: www.sipforum.org- SIP Foundry: www.sipfoundry.org- OpenSBC: www.opensourcesip.org

Page 24: Developing SIP Applications

© Voxeo Corporation

Open Source SIP Software

- Systems- Asterisk: www.asterisk.org- sipXecs: www.sipfoundry.org- FreeSWITCH: www.freeswitch.org- OpenSER: www.openser.org

- SIP Stacks- reSIProcate: www.resiprocate.org

- Phones:- Gizmo: www.gizmoproject.org

- MANY, many more: www.voip-info.org

Page 25: Developing SIP Applications

© Voxeo Corporation

Religion

Page 26: Developing SIP Applications

© Voxeo Corporation

XML

Page 27: Developing SIP Applications

© Voxeo Corporation

CCXML

- Call Control XML (CCXML) is the W3C standard for call control using XML

- Sister standard to VoiceXML- Integrates with VoiceXML for dialog control- Provides a framework for issuing call control commands and handling call control events

- http://www.w3.org/TR/ccxml/

Page 28: Developing SIP Applications

© Voxeo Corporation

Page 29: Developing SIP Applications

© Voxeo Corporation

CCXML Hello World<?xml version="1.0" encoding="UTF-8"?><ccxml version="1.0"> <eventprocessor>

<transition event="connection.alerting"> <log expr="'***** CONNECTION ALERTING *****'"/> <if cond="event$.connection.remote == '8315551234'"> <reject/> <else/> <accept/> </if> </transition>

<transition event="connection.connected"> <log expr="'***** CALL WAS ANSWERED *****'"/> </transition>

<transition event=”connection.disconnected”> <log expr=”‘*** Call was disconnected ***’”/> <exit/> </transition>

<transition event="error.*"> <log expr="'an error has occured (' + event$.reason + ')'"/> <exit/> </transition> </eventprocessor></ccxml>

Page 30: Developing SIP Applications

© Voxeo Corporation

Java?

Page 31: Developing SIP Applications

© Voxeo Corporation

SIP Servlets

- Standard Java based API for writing SIP applications.

- 1.0 standardized as JSR-116. - 2.0 just released as JSR-289- Extends the HTTP Servlet model to support SIP and telephony applications

- http://www.sipservlet.com/- Supported by a large number of application servers including Oracle (BEA), IBM, Sun, Voxeo.

31

Page 32: Developing SIP Applications

© Voxeo Corporation

Converged Applications

Page 33: Developing SIP Applications

© Voxeo Corporation

JSR-309

- Java Media Server API- Based on the CCXML media model - Still in draft stage- Provides dialog resources, conferencing, media routing to Java applications

33

Page 34: Developing SIP Applications

© Voxeo Corporation

Example Application

Page 35: Developing SIP Applications

© Voxeo Corporation

Sample Application Overview

- Caller dials in to the application

- Caller is bridged to the subscriber

- Results of the call attempt are posted to Twitter via their REST API

35

Page 36: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

36

Page 37: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

37

Page 38: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

38

<?xml version="1.0" encoding="UTF-8"?><ccxml version="1.0" xmlns="http://www.w3.org/2002/09/ccxml"></ccxml>

Page 39: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

39

Page 40: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

40

<var name="state" expr="'init'"/><var name="incomingcall"/><var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/>

<eventprocessor statevariable="state"></eventprocessor>

Page 41: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

41

Page 42: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

42

<transition event="connection.alerting" state="init"> <accept/></transition>

Page 43: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

43

Page 44: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

44

<transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/></transition>

Page 45: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

45

Page 46: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

46

<transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/></transition>

Page 47: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

47

Page 48: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

48

<transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/></transition>

Page 49: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

49

Page 50: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

50

<transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/></transition>

Page 51: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

51

Page 52: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

52

<transition event="send.successful" state="done"> <exit/></transition>

Page 53: Developing SIP Applications

© Voxeo Corporation

<?xml version="1.0" encoding="UTF-8"?><ccxml xmlns="http://www.w3.org/2002/09/ccxml" version="1.0"> <var name="state" expr="'init'"/> <var name="incomingcall"/> <var name="tURL" expr="'http://zscgeek:[email protected]/statuses/update.xml'"/> <eventprocessor statevariable="state"> <transition event="connection.alerting" state="init"> <accept/> </transition> <transition event="connection.connected" state="init"> <assign name="state" expr="'calling'"/> <assign name="incomingcall" expr="event$.connectionid"/> <createcall dest="'tel:+18312392883'"/> </transition> <transition event="connection.connected" state="calling"> <assign name="state" expr="'connected'"/> <join id1="event$.connectionid" id2="incomingcall"/> <var name="status" expr="'RJ is on the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.failed" state="calling"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is not answering his phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="connection.disconnected" state="connected"> <assign name="state" expr="'done'"/> <var name="status" expr="'RJ is off the phone'"/> <send targettype="'basichttp'" name="'update'" target="tURL" namelist="status"/> </transition> <transition event="send.successful" state="done"> <exit/> </transition> </eventprocessor></ccxml>

Follow Me/Find Me + Twitter

53

Page 54: Developing SIP Applications

© Voxeo Corporation

We Got Java Bean!

Page 55: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

55

Page 56: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

56

Page 57: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

57

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

Page 58: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

58

Page 59: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

59

public class FMServlet extends SipServlet { public void init() throws ServletException { }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { }}

Page 60: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

60

Page 61: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

61

Api twitter_api;List<URI> targets;

public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]"));}

Page 62: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

62

Page 63: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

63

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); }}

Page 64: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

64

Page 65: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

65

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch(TwitterException e){log("failed to update twitter",e);} }}

Page 66: Developing SIP Applications

© Voxeo Corporation

package com.voxeo.rj.fmdemo;

import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.sip.*;import net.unto.twitter.Api;import net.unto.twitter.TwitterException;

public class FMServlet extends SipServlet { Api twitter_api; List<URI> targets; public void init() throws ServletException { twitter_api = new Api("zscgeek", "password"); SipFactory sipFactory = (SipFactory)getServletContext().getAttribute(SIP_FACTORY); targets = new ArrayList<URI>(); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); targets.add(sipFactory.createURI("sip:[email protected]")); }

protected void doInvite(SipServletRequest req) throws ServletException, IOException { if (req.isInitial()) { Proxy proxy = req.getProxy(); proxy.setRecordRoute(true); proxy.setParallel(true); proxy.proxyTo(targets); } }

protected void doSuccessResponse(SipServletResponse resp) throws IOException { if (resp.getMethod().equalsIgnoreCase("invite")) { try { twitter_api.updateStatus("RJ is taking a phone call from " + resp.getRequest().getRequestURI()); } catch (TwitterException e) {log("failed to update twitter",e);} } }}

Follow Me/Find Me + Twitter

66

Page 67: Developing SIP Applications

© Voxeo Corporation

So why is this important?

Page 68: Developing SIP Applications

© Voxeo Corporation

Web Developers

Phone Developers Web Developers

Page 69: Developing SIP Applications

© Voxeo Corporation

Web

Page 70: Developing SIP Applications

© Voxeo Corporation

Ideas We have Never Thought Of

Page 71: Developing SIP Applications

© Voxeo Corporation

Standards Matter

Page 72: Developing SIP Applications

© Voxeo Corporation

Example Usage

Page 73: Developing SIP Applications

© Voxeo Corporation

Project Green Phone

- By Mark Headd- http://www.voiceingov.org/blog/?p=135- VoiceXML, JavaScript, CCXML, PHP- Application:

- Caller dials in to app- App uses ANI/Caller ID and makes web service query to a database to determine location

- Makes another web service query to find location of nearest E85/Biodiesel stations

- Relays information to caller- Sends caller a SMS text msg with info

Page 74: Developing SIP Applications

© Voxeo Corporation

Rocketsource.org

- www.rocketsource.org

- Vox-Attendant- A VoiceXML-based, speech-driven auto attendant that can connect callers

with any person or group with an enterprise, via their desk, cellular, or VoIP phones.

- Vox-Mail- A VoiceXML-based, speech-driven voicemail application that can store

messages locally or integrate with any IMAP email server to provide basic unified messaging.

- Voice Conference Manager- A VoiceXML and CCXML-based, speech-driven conference manager that

features both phone and web-based conference call creation, access, and management.

- VoiceXML, CCXML, grXML, JavaScript, Java, and Python

Page 75: Developing SIP Applications

© Voxeo Corporation

Wrapping Up

Page 76: Developing SIP Applications

© Voxeo Corporation

Look at the big picture

http://flickr.com/photos/txd/100437832

Page 77: Developing SIP Applications

© Voxeo Corporation

More then one way to skin a cat!

Page 78: Developing SIP Applications

© Voxeo Corporation

Avoid the Mouse Trap

Page 79: Developing SIP Applications

© Voxeo Corporation

Be ready to scale

Page 80: Developing SIP Applications

© Voxeo Corporation

Page 81: Developing SIP Applications

© Voxeo Corporation

RJ [email protected]

http://www.voxeo.com/prophecyhttp://evolution.voxeo.com


Top Related