[Users] Differentiate INVITEs

Kristian Kielhofner kris at krisk.org
Thu May 10 19:00:56 CEST 2007


Hello Everyone,

  I am trying to implement music on hold with Asterisk.  I know that
this has been asked before, but I have searched through the archives
and I think I am doing something a bit different...

  Here is the situation:

Components:
Phone (registered to OpenSER)

Cisco GW (connects to PSTN)

OpenSER (in the middle of this mess)

Diagram Outgoing Call:

Phone -> OpenSER (Authentication, LCR, record route, NAT traversal,
yada yada) -> Cisco GW

Incoming:

Cisco GW -> OpenSER (locations lookup, record route, NAT traversal,
yada yada) -> Phone


  OpenSER catches any INVITE from the phone and routes it as
necessary.  The above config works perfectly except for hold/music on
hold.

  As I understand it, music on hold is implemented with a re-INVITE
(from the phone) with a 0.0.0.0 address in the SDP (c=IN IP4 0.0.0.0).
 I think that if I had a way to check for this I could route the
re-INVITE for hold to an Asterisk server to run music on hold instead
of routing it to the Cisco GW (which is what happens now).  A few
questions:

1)  Is there a better way to differentiate a re-INVITE for hold/moh
vs. just a regular INVITE?
2)  Is there a way to do this in OpenSER (either using some kind of
matching based on SDPs or some other method)?
3)  Is there any reason this wouldn't work?

  I'm thinking that the Asterisk side would be fairly simple, with a
context like this for the incoming INVITEs to play music on hold:

exten => _NXX.,1,Answer ; (can't hurt)
exten => _NXX.,n,MusicOnHold(default)
exten => _NXX.,n,Hangup

  ... or something to that effect.

  What do you think?  Any and all comments welcome.

Thanks!

-- 
Kristian Kielhofner




More information about the Users mailing list