A Stepwise Approach to Developing Languages
for SIP Telephony Service Creation
Nicolas Palix*, Charles Consel*, Laurent Réveillère*, Julia Lawall†
†
* Phoenix Group DIKU
LaBRI – INRIA, France University of Copenhagen, Denmark
{palix, consel, reveillere}@labri.fr [email protected]
2
Introduction
SIP telephony services
Enriched telephony services
• Address book
• Calendar
• Email
• CRM
Legacy technologies
• General-purpose languages
– Large and complex low-level platform APIs
– Error-prone
• Scripting languages
– High-level
– Dedicated to the telephony domain
3
Issues
Legacy technologies
• Formal semantics unavailable
• Reference implementation may be unavailable
Service developers
• Must study reference implementation
• Must not corrupt the underlying platform
Platform developers
• Difficult to port a language to another run-time system
• Difficult to provide another implementation of a run-time system
How to design and develop a scripting language dedicated to
the development of robust telephony services?
4
Our Approach
Domain Specific
Language
Static semantics
• Simple and expressive
• Type checker • Reflects the SIP VM
• Service analyses abstractions
• Formally defined
Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Dadadadflsdfnsdk
Sdasdddfksdnfmklsdjfnks
Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
• Static semantics
• Dynamic semantics
Dadadadflsdfnsdk
Dsadsadeiwqodndiofgwjr9timnf
Dsadsaderjfrtjwfnsddaodnqi
Sdasdddfksdnfmklsdjfnks
Sdadadmfodsfmnrjewifjmnfjkldfn
dadadajnfilsdfnw Dsadsadeiwqodndiofgwjr9timnf
Sdasddd Dsadsaderjfrtjwfnsddaodnqi
kfnsfnsifuwnfisdn Sdadadmfodsfmnrjewifjmnfjkldfn
dadadajnfilsdfnw
Dsadsadfs,fpjwotijwogjsg
Sdasddd
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf kfnsfnsifuwnfisdn
Dsadsadfs,fpjwotijwogjsg
Dadadapeork03qrjfm wopi ne;o
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf
Dadadapeork03qrjfm wopi ne;o
SPL
Domain Specific
SIP Virtual Machine SIP Dynamic semantics
Virtual Machine • Defines SPL runtime
• Raises the abstraction
behavior
level
• Consists of a set of • Eases implementation
events and a state SIP Platform
• Focuses on sessions • Verifies runtime properties
5
1st Step: A SIP Virtual Machine
• Refines SIP messages in
events
• Manages sessions
Dialog Dialog
Virtual Machine Events
INVITESIP
REINVITE
INVITEBYE
Virtual Machine
SIP Messages
INVITE
INVITE
Internet
INVITE
Internet SIP Platform
BYE
6
1st Step: A SIP Virtual Machine
Service • Refines SIP messages in
Registration
events
• Manages sessions
Dialog Dialog
INVITE INVITE BYE
• Organizes sessions
REINVITE
hierarchically
• Introduces SIP VM events
SIP
REGISTER
unregister
deploy
undeploy
Virtual Machine
• Stores and restores
service state
Internet
REGISTER
Internet SIP Platform
7
2nd Step: The Session Processing Language
response incoming INVITE() {
[…]
response resp = forward;
INVITE
if (resp == /ERROR) {
resp = forward
INVITE
secretary
'sip:
[email protected]';
}
return
OK resp;
}
SPL
INVITE
SIP
INVITE
INVITE BUSYOK
Virtual
OK Machine
secretary
BUSY
INVITE
Internet
SIP Platform
Internet
Multimedia connection OK
8
2nd Step: The Session Processing Language
service hotline {
...
processing {
uri<100> employees = <>;
void deploy() {...}
void undeploy() {...}
registration {...
response outgoing REGISTER() {
uri employee = FROM;
push employees employee;
return forward;
}
...
dialog { ...
response incoming INVITE() {
return forward employees;
}
}
}
}
}
9
Advanced features: Inter-Event Control Flow
dialog {
response incoming INVITE() {
response r;
...
if (...) {
...
return r branch hotline; INVITE ACK BYE
}
else {
...
return r branch personal;
}
}
INVITE ACK BYE
void incoming ACK(){ request request request
branch hotline {... }
branch default {... }
}
response BYE() {
branch hotline {... }
branch personal {... }
branch default {... }
}
}
10
3rd Step: Formal Semantics
Static semantics
How to verify properties
which are critical for the
telephony domain? Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Dadadadflsdfnsdk
Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Sdasdddfksdnfmklsdjfnks
Dadadadflsdfnsdk
Dsadsadeiwqodndiofgwjr9timnf
Dsadsaderjfrtjwfnsddaodnqi
Sdasdddfksdnfmklsdjfnks
Sdadadmfodsfmnrjewifjmnfjkldfn
Dsadsadeiwqodndiofgwjr9timnf
dadadajnfilsdfnw
Sdasddd Dsadsaderjfrtjwfnsddaodnqi
Sdadadmfodsfmnrjewifjmnfjkldfn
• Type-checking
kfnsfnsifuwnfisdn
dadadajnfilsdfnw
Dsadsadfs,fpjwotijwogjsg
Sdasddd
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf kfnsfnsifuwnfisdn
Dsadsadfs,fpjwotijwogjsg
Dadadapeork03qrjfm wopi ne;o
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf
Dadadapeork03qrjfm wopi ne;o
• Service analyses
e.g. forward use SPL
Dynamic semantics
SIP • Defines SPL runtime
Virtual Machine behavior
• Eases implementation
• Verifies runtime properties
SIP Platform
11
Static semantics: Type-Checking
dialog {
uri caller;
time start;
response incoming INVITE() {
caller = FROM;
return forward;
}
void incoming ACK(){
if(caller == 'sip:
[email protected]')
log(“Personal call”);
start = getTime();
}
response BYE() {
string duration = time_to_string(getTime() – start);
log(“Call: ”+ duration +” ”+uri_to_string(caller));
return forward;
}
}
12
Static semantics: Service Analyses
Example of property to ensure: forward use
When a positive response is received, no
additional forwarding operation is allowed
Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Dadadadflsdfnsdk
Sdasdddfksdnfmklsdjfnks
Dsadsadeiwqodndiofgwjr9timnf
Dsadsaderjfrtjwfnsddaodnqi
Sdadadmfodsfmnrjewifjmnfjkldfn
dadadajnfilsdfnw
Sdasddd
kfnsfnsifuwnfisdn
Dsadsadfs,fpjwotijwogjsg
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf
Dadadapeork03qrjfm wopi ne;o
forward
SPL
SIP
OK
Virtual Machine
SIP Platform OK
Internet
Internet
13
Service Analyses - forward Use Example
response incoming INVITE() { Concrete syntax
[…]
response r = forward;
if (r == /ERROR) {
r = forward 'sip:
[email protected]';
return r;
}else {
return r;
}
}
response Some(incoming) INVITE {
response r;
r = fwd None;
cond(r == /ERROR,
r = fwd Some (sip:
[email protected]);
return r,
return r)
} Abstract syntax
14
forward Use Analysis for a Valid Service
response Some(incoming) INVITE {
response r;
Call r = fwd None;
cond(
r == /ERROR,
Internet r = fwd Some (
[email protected]);
Internet
return r,
return r
)
Environment τ Safe
}
True
(r, error) True
(r, ⊥) True
(r, error) True
(r, success) True
(r, ⊥) True
(r, ⊥) True
(r, success) True
(r, ⊥) True
15
Service Analyses - forward Use Example
response incoming INVITE() {
[…]
response r = forward;
if (r == /ERROR) {
r = forward 'sip:
[email protected]';
return r;
} else {
return r;
}
}
response incoming INVITE() {
[…]
response r = forward;
if (r == /ERROR) {
return r;
} else {
r = forward 'sip:
[email protected]';
return r;
}
}
16
forward Use Analysis for an Invalid Service
response Some(incoming) INVITE {
response r;
Call
r = fwd None;
cond(r == /ERROR,
Internet
return r,
Internet
r = fwd Some (
[email protected]);
return r
)
} Environment τ Safe
True
(r, error) True
(r, ⊥) True
(r, error) True
(r, success) True
(r, error) True
(r, success) False
(r, success) False
(r, ⊥) False
17
3rd Step: Formal Semantics
Static semantics
How to verify properties
which are critical for the
telephony domain? Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Dadadadflsdfnsdk
Dsadsadfmsdfklsdmfolmfosfn
Sdadadfdklsfjsdofmnsdklfjsdf
Sdasdddfksdnfmklsdjfnks
Dadadadflsdfnsdk
Dsadsadeiwqodndiofgwjr9timnf
Dsadsaderjfrtjwfnsddaodnqi
Sdasdddfksdnfmklsdjfnks
Sdadadmfodsfmnrjewifjmnfjkldfn
Dsadsadeiwqodndiofgwjr9timnf
dadadajnfilsdfnw
Sdasddd Dsadsaderjfrtjwfnsddaodnqi
Sdadadmfodsfmnrjewifjmnfjkldfn
• Type-checking
kfnsfnsifuwnfisdn
dadadajnfilsdfnw
Dsadsadfs,fpjwotijwogjsg
Sdasddd
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf kfnsfnsifuwnfisdn
Dsadsadfs,fpjwotijwogjsg
Dadadapeork03qrjfm wopi ne;o
Dsadsad,mfiopjfowifmnioune
Sdadadspfmoiwerfmnrowimf
Dadadapeork03qrjfm wopi ne;o
• Service analyses
e.g. forward use SPL
Dynamic semantics
SIP • Defines SPL runtime
Virtual Machine behavior
• Eases implementation
• Verifies runtime properties
SIP Platform
18
A Direct Interpreter Implementation
From The Dynamic Semantics
let interpret message phi sigma service =
match message with
(I_INVITE(rid, did), direction, rqid) ->
let address = [service;(Reg, rid);(Dial, did)] in
let branch = lookup_branches(sigma, parent(address)) in
let sigma' =
create_session(phi, sigma, address, branch, Some(If.UNINVITE)) in
let (m_par, decls, stmts, envs, sigma'') =
prepare_handler(phi, sigma', address, direction, If.INVITE) in
let tau = (sigma'', address) in
let rho = (envs, (m_par, rqid), []) in
spl_handler_body tau rho ([]::[[T_INITIAL_INVITE(phi)]]) (decls, stmts)
19
Dynamic Semantics
About 100 semantic rules
Documentation
• To understand program behavior
• To implement the SPL interpreter
• Language independent
Straightforward implementation
• 1 week in OCaml
• 2 weeks in JAVA
20
Conclusion
Stepwise approach
• Domain-Specific virtual machine
• Domain-Specific Language
• Formal semantics
Benefits
• High-level language
• Robust and verifiable services
• Straightforward implementation
The Session Processing Language
• A call queuing service in about 100 lines
• A SIP application server based on JAIN SIP API
21
Ongoing Work
Other SPL properties
• Feature Interactions
–Multiple users
–Multiple services
• Inter-event control flow reachability
• Optimizations
Πανταχου (Pantachou)
• Composition language for ubiquitous services
• Rely on SIP network
22
Thank You For Your Attention !
http://phoenix.labri.fr/software/spl/