31
A Programmable Message Classification engine for A Programmable Message Classification engine for Session Initiation Protocol Session Initiation Protocol Arup Arup Acharya Acharya Xiping Xiping Wang Wang Charles Wright Charles Wright Internet Infrastructure & Computing Utilities Internet Infrastructure & Computing Utilities IBM TJ Watson Research Center IBM TJ Watson Research Center

A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

A Programmable Message Classification engine for A Programmable Message Classification engine for Session Initiation ProtocolSession Initiation Protocol

Arup Arup AcharyaAcharya XipingXiping WangWang Charles WrightCharles Wright

Internet Infrastructure & Computing UtilitiesInternet Infrastructure & Computing UtilitiesIBM TJ Watson Research CenterIBM TJ Watson Research Center

Page 2: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

2

SIP and SIMPLE Session Initiation Protocol (SIP) - an Internet signaling protocol for setting up multimedia sessions

• Defines a new control /signaling layer and control servers, in parallel to the media

• It is a client to client (peer to peer) technology mediated through control servers – it is NOT a client-server protocol (unlike HTTP).

SIMPLE : SIP extensions to support Presence and Instant Messaging• Publish/Subscribe mechanism• Instant Messages : Page mode , Session Mode

SIP is the basis for IMS (IP Multimedia Subsystem)

SIP has been around since 2001 – large VoIP and IM/Presence deployments already exists (SIP, XMPP, proprietary)• IETF came out with RFC 2543 in ’99, RFC 3261 in 2002• SIP is the basis for IP Multimedia Subsystems (IMS) being deployed by cable, wireline and wireless operators

SIP proxy

SIP proxy

V V V V

SIP proxy

SIP signaling

RTP/UDP voice packets

SessionBorderController

EnterpriseFirewall

Presence Serverregistrar

Application (conferencing,Voicemail,..)

Presence/ IMClient

IP Phone

Page 3: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

3

Sample SIP session : VoiceSample SIP session : Voice--overover--IP callIP call

200 (OK)

INVITE180 (Ringing)180 (Ringing)

200 (OK)ACK ACK

RTP MEDIA PATH

BYE BYE

200 (OK) 200 (OK)

Call Teardown

MediaPath

Call Setup

INVITE

Proxy

200 (OK)

INVITE

180 (Ringing)

ACK

BYE

200 (OK)

Proxy User AgentUser Agent

Transactio

Transactio

SIPDialo

Page 4: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

4

SIP message structureSIP message structureSyntactically similar, Semantically more complex than HTTPHTTP is client-server; SIP is client-to-client intermediated by multiple servers

► Message may undergo transformation at each hopSIP is a control protocol; media is separate

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP sip-proxy.watson.ibm.comFrom: Charles Wright <sip:[email protected]>To: Arup Acharya <sip:[email protected]>Call-ID: [email protected]: 1 INVITEExpires: 180User-Agent: Cisco IP Phone/ Rev. 1/ SIP enabledAccept: application/sdpContact: sip:[email protected]:5060Content-Type: application/sdpContent-Length : 124

v=1o=-V=-C=IN IP4 9.2.91.243t=-m=video 4004 RTP/AVP 13 26a=rtpmap:14 MPA/90000

UDP Header

IP Header

Opaque Media descriptor

Message headers (e.g., From)

Message Type(e.g., INVITE)

Page 5: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

5

Scaling systems and software for SIP Scaling systems and software for SIP

Session Setup (voice/ video)

Coupled Signaling & Media Interactions, e.g. Session Border Controllers, Conference

Presence►Rate of subscription / notification requests

►Updates in presence information, including non-SIP sources

Instant Messaging►Number of messages

►Size of messages

SIP proxySIP proxy

SessionSessionsetup setup

RTP/UDP packets (media)

ApplicationServer

Redirect/ location server

Registrationserver

RegistrationRegistration

SessionSessionsetup setup

RTP/UDP packets (media)

SIP Server

Packetprocessing InstantInstant

Message Message

Presence server

SUBSCRIBESUBSCRIBENOTIFYNOTIFY

PresenceInformation

-SIP registrar-Network login(e.g. 3G)- ..

IM Server

ControlControl

Page 6: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research

© 2006 IBM Corporation6

A Programmable SIP message Classification Engine A Programmable SIP message Classification Engine

Goal : Classify incoming SIP messages according to user-defined rules (and actions) before they are processed by a server– Use-case : maximize utility / revenue, not raw throughput under server

overload

Challenge: fast & efficient SIP traffic classificationKey contributions :

• Designed a novel ALGORITHM specifically exploiting SIP message headers

• Classification algorithm is PROGRAMMABLE– Multi-purpose : Overload control, Denial-of-Service protection,

Prioritization,..

• Classification engine is STATEFUL

• SIP Server needs no modification; can work with multiple types of SIP servers

• In-kernel Linux implementation for EFFICIENCY

Page 7: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

7

PrioritizedSIP messages

Transport-Specific

Processing

SIP Message

ClassificationQueuing

CategorizedSIP messages

SIP messagesNetwork Packets

Classifier and Supporting Environment

Sender Receiver

1.7Ghz Pentium IV 1.7Ghz Pentium IV3.0Ghz Xeon Blade

SIP Server(SIP Express Router)

Classifier

Reordered Packets

1Gbps Network

1Gbps Network

Operator-defined rules

Page 8: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

8

SIP message structureSIP message structureSyntactically similar, Semantically more complex than HTTPHTTP is client-server; SIP is client-to-client intermediated by multiple servers

► Message may undergo transformation at each hopSIP is a control protocol; media is separate

INVITE sip:[email protected] SIP/2.0

Via: SIP/2.0/UDP sip-proxy.watson.ibm.comFrom: Charles Wright <sip:[email protected]>To: Arup Acharya <sip:[email protected]>Call-ID: [email protected]: 1 INVITEExpires: 180User-Agent: Cisco IP Phone/ Rev. 1/ SIP enabledAccept: application/sdpContact: sip:[email protected]:5060Content-Type: application/sdpContent-Length : 124

v=1o=-V=-C=IN IP4 9.2.91.243t=-m=video 4004 RTP/AVP 13 26a=rtpmap:14 MPA/90000

UDP Header

IP Header

Opaque Media descriptor

Message headers (e.g., From)

Message Type(e.g., INVITE)

Page 9: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation9

ExampleExample scenario for classification: Overload control scenario for classification: Overload control

Input rule set specifies call handoff messages are more valuablethan call-setup (as would be the case for a mobile operator)– Rule conditions specify how to distinguish between handoff and

setup messages– Rule actions prioritize handoff ahead of call setup during overload

Classification is multi-purpose due to its programmability – Swiss army knife for IMS– Value-driven overload control is only one possible usage

Page 10: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation10

InIn--Kernel SIP Classification Algorithm : overviewKernel SIP Classification Algorithm : overview

Method

To

To.tag

Status

INVITE [email protected] SIP/2.0

To: Arup Acharya <[email protected]>;tag=24

From: Charles P. Wright <[email protected]>;tag=42

Method == “INVITE”

To.tag != NULL

To.tag == NULL

Status >= 100

Status <= 199

1 1 0 0 01 1 0 0

0 0

0 0 0 1

0

1

1

1 0

INVITE

Arup <[email protected]>;tag=42

24

NULL

Method == “INVITE” && To.tag != NULL -> Re-Invite

Method == “INVITE” && To.tag == NULL -> Invite

Status >= 100 && Status <= 199 -> Provisional

Rule Compiler

User-specified RulesHeader Table

Condition TableParser

SIP Message

Header Value Table

Condition EvaluationCondition Bit Mask

Rule matchingFinal ClassificationRe-Invite

Rule Bit Masks

Page 11: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation11

SER Performance without classifier [25% handoff] SER Performance without classifier [25% handoff]

0

5000

10000

15000

20000

25000

30000

35000

0 20000 40000 60000 80000 100000 120000

Ach

ieve

d Lo

ad (m

essa

ges/

seco

nd)

SER (Setup)

SER (Handoff)

Offered Load (messages/second)

SER’s peak msg handling rate ~ 40K msgs/sec

Traffic mix : 25% handoff msgs

Page 12: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation12

Comparison : Comparison : ThruputThruput and quality of and quality of thruputthruput

0

20000

40000

60000

80000

100000

120000

0 20000 40000 60000 80000 100000 120000

Offered Load (messages/second)

Ach

ieve

d Lo

ad (m

essa

ges/

seco

nd)

SER without classifier (Thruput)

SER+Classifier(Thruput )

Classifier (+ SER)(Messages Processed)

SER with classifier is able to classify about 105K msgs/sec, with some drop in peak thruput to 31K msgs/sec compared to a peak thruput (40K msgs/sec) for SER without classifier.

Page 13: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation13

Call Handoff (HighCall Handoff (High--Priority) Performance : with/out classifierPriority) Performance : with/out classifier

0

5000

10000

15000

20000

25000

30000

0 20000 40000 60000 80000 100000 120000

Offered Load (m essages/second)

Ach

ieve

d Lo

ad (m

essa

ges/

seco

nd)

SER (Handoff )

Classif ier (Handoff )

Page 14: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM Research/STG

© 2006 IBM Corporation14

Call Setup (LowCall Setup (Low--Priority) Performance : with/out classifierPriority) Performance : with/out classifier

0

5000

10000

15000

20000

25000

30000

35000

0 20000 40000 60000 80000 100000 120000

Offered Load (m essages/second)

Ach

ieve

d Lo

ad (m

essa

ges/

seco

nd)

SER (Setup)

Classif ier (Setup)

Page 15: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation15

Classifier use-case : Session Dispatching

….

Server 1

Server 2

Server 3

Server n

Classifier

Dispatcher

Transport Processing

Incoming

Packets

SIP

Messages

Colored

SIP

Messages

SIP Server Farm

SIP Aware Dispatcher

Page 16: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

16

Classifier useClassifier use--case : realcase : real--time monitoring of SIP calltime monitoring of SIP call--flowsflows

If a SIP call fails, can we debug in real-time?►SIP messages get transformed at each hop►Each server runs a per-session state-machine

Not always possible to correlate messages using Call-ID field, e.g.

►Call-forking – each leg has same call-id but different To headers►When joining a conference►Call transfer (REFER)

Different header subsets needed for correlation (context dependent)

►Programmability of classifier useful

Solution approach : trace the message transformations on each hop, trace call flow in real-time and try to deduce state-changes on the server

correlatecorrelate

Server Systems Server Systems

SIP Software SIP Software (proxy/ registrar /..)(proxy/ registrar /..)

INVITE sip:arup@workCall-ID : abcd

classifyclassify

StateStateS1S1

StateStateS2S2

Input Msg

Outgoing Msg

INVITE sip:arup@homeCall-ID : abcd

ACM Workshop on Mining Network Data (MineACM Workshop on Mining Network Data (Mine--Net) 2007. Net) 2007. A. A. AcharyaAcharya, , X.WangX.Wang, C. P. Wright, N. , C. P. Wright, N. BanerjeeBanerjee, K. , K. DasguptaDasgupta

Page 17: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

17

Classifier useClassifier use--case : monitoring SIP serverscase : monitoring SIP servers

Monitoring traffic entering a SIP server (eg CSCF in IMS)► Measured values can be fed back to an system-wide monitor► Advance warning about overload, anomalies (measure response times)

Regulating traffic entering a SIP server, eg prioritization, overload control► Classification rules (and associated actions) can be downloaded to the classifier, in accordance with

system-wide policy

Key point : Classifier is programmable and so can be tailored for multiple scenarios

Packet Capture

Mechanism

SIP Message

ClassificationStatistics/Actions

SIP Server(s)

CategorizedSIP messages

SIP messages

Classifier

Classifier and Supporting Environment

Page 18: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

18

Current work in progressCurrent work in progressClassification engine is a tool – exploring how to program it for different scenarios► Integrating classification engine within DataPower

– DataPower is an XML appliance with an embedded Linux kernel► SIP monitoring agent

Collaboration with academia► Penn State Univ

– Overload control : compare in-kernel vs application-level approaches► Georgia Tech

– Security : VoIP DoS attack prevention, Anomaly detection

Page 19: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

19

Future workFuture work

We have studied one use-case (value-driven overload control) so far, which looked promising - huge scope to explore further

Study how complexity of rules impact performance

Explore stateful use-cases and impact of state maintenance on performance

Expand design to handle SIP over TCP and SSL connections

Better interlock between SIP Proxy / Application and Classifier

Combine SIP header classification with message body inspection► Presence messages carry XML bodies (describing event that is

published/subscribed)

► Inject SIP awareness into XML appliances

If you have ideas, we will be happy to collaborate with you

Page 20: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

Thanks for your time!Thanks for your time!

Questions?Questions?

Contact : Contact : Arup Acharya Arup Acharya [email protected]@us.ibm.com

Details of this project and other project can be found atDetails of this project and other project can be found at http://http://research.ibm.com/people/a/arupresearch.ibm.com/people/a/arup//

Page 21: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

21

Possible instantiationsPossible instantiations

Linux kernel module co-located with server machine

Front-end box with classifier

FPGA / Network-processor based implementation of classification engine► Server Network interface card

► Additional hw/sw engine for Datapower

Programmability provided by external rule-sets (downloaded to classification engine)

Page 22: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation22

HTV StructureAll values in the classifier are maintained as header table value structures (HTVs)

– Primitive HTV Types: String (e.g., “Method” or “From”), Integer (e.g., “Status”), String List (e.g., “Via”), Null (e.g., a header that was not found)

– Complex HTV Types: Tuple, Pointer, Structure, Array• Tuple: An ordered list of N HTVs (where N is fixed)• Pointer: A pointer to another HTV• Structure: User-Space Type with named members, that is

translated into a Tuple at rule compilation time• Array: An associative array of elements. Given a key HTV

returns a value HTV.

Page 23: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation23

Associative ArraysEnable the classifier to maintain complex state for each dialog,transaction, etc.

Maps a key to a value

Every array stores tuples, the first element is the key, the remaining elements are the value– The key and value may also be tuples

Implemented using linear hashing [Larson 1988]– Dynamically sizes hash table, without the need to rehash every bucket

when the load factor is exceeded

Page 24: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation24

ActionsActions are defined using a simple three-address code

– Operator• Arithmetic: ADD, MULTIPLY, SUBTRACT, MOD, DIVIDE• Arrays: INSERT, REMOVE (find is done of belongs-to operator

in rules)• Tuples: TUPALLOC, TUPEXTRACT, TUPASSIGN• Other: TIME, COLOR (for overload control)

– Operands are all HTVs• May be immediate, a Header (from the Header Value Table) or a

Variable– Next pointerRule compiler currently provides named subroutines

Future work: provide simpler C-like syntax in rule-compiler rather than assembler-like syntax

Page 25: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation25

Parsing SIP MessagesEach header or pseudo-header has a priority (lower numbers are executed first)Negative numbers are used for the SIP request/response line, which validates the message is in fact SIPStandard SIP headers have a priority of “zero” and are concurrently located in the message using a series of C switch statements– Experimentally determined that simple switch was more efficient

than hashing the header and performing a lookup or multi-pattern matching structures like SBOM

– Intuition: enables us to match 4 characters at a time, with a series of simple comparisons

– If we are not matching on set-valued headers, can terminate the search after all of the headers are found

Sub-headers and tuples have a positive priority, and are derived from the standard headers using simple functions

Page 26: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation26

Session DispatchingStruct Session = {String ID, Int Server Int Expire}

Global Session: %ActiveSessions

Local Session: $NewSession, *CurrentSession

Local Int: $MyServer

Global Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

Page 27: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation27

Session DispatchingStruct Session = {String ID, Int Server Int Expire}Global Session: %ActiveSessionsLocal Session: $NewSession, *CurrentSession

Local Int: $MyServerGlobal Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

Initialization: The number of servers is configured (0 through 2), and we dispatch the first request to server 0. A thread to expire sessions is created.

Page 28: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation28

Session DispatchingStruct Session = {String ID, Int Server Int Expire}Global Session: %ActiveSessionsLocal Session: $NewSession, *CurrentSession

Local Int: $MyServerGlobal Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

If a packet matches an existing session, then use the existing server. Update the expiration timer to 15 minutes in the future.

Page 29: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation29

Session DispatchingStruct Session = {String ID, Int Server Int Expire}Global Session: %ActiveSessionsLocal Session: $NewSession, *CurrentSession

Local Int: $MyServerGlobal Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

If a packet matches an existing session, then use the existing server. Update the expiration timer to 15 minutes in the future.

Page 30: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation30

Session DispatchingStruct Session = {String ID, Int Server Int Expire}Global Session: %ActiveSessionsLocal Session: $NewSession, *CurrentSession

Local Int: $MyServerGlobal Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

If a packet does not match an existing session, then insert an entry into %ActiveSessionswith the value of $CurrentServer and dispatch it to the same

Page 31: A Programmable Message Classification engine for Session … SIP... · 2007. 12. 4. · Sample SIP session : Voice-over-IP call 200 (OK) INVITE 180 (Ringing) 180 (Ringing) 200 (OK)

IBM T.J. Watson Research Center

© 2007 IBM Corporation31

Session DispatchingStruct Session = {String ID, Int Server Int Expire}Global Session: %ActiveSessionsLocal Session: $NewSession, *CurrentSession

Local Int: $MyServerGlobal Int: $CurrentServer, $nServers

Init -> $CurrentServer = 0, $nServers = 3, ExpiryThread(%ActiveSessions, Expire)

10:*CurrentSession = Call-ID belongs-to %ActiveSessions -> *CurrentSession.Expire = Now() + 900, Color *CurrentSession.Server

20: NOT Call-ID belongs-to %ActiveSessions -> $MyServer = $CurrentServer++ % $nServers, $NewSession = (Call-ID, $MyServer, Now() + 900), Insert(%ActiveSessions, $NewSession), Color $MyServer

30: Response >= 200 && CSeq.Method == “BYE” && *CurrentSession = Call-ID belongs-to %ActiveSessions -> Remove(%ActiveSessions,*CurrentSession), Color *CurrentSession->Server

On receipt of the BYE, remove the call from %ActiveSessions, and send the call to the proper server.