Music on Hold with CGPL

This solution was submitted by Marcos Taschelmayer and Rafael Veiga Saluotto of GetNet Comunicações.

The CG/PL code and CommuniGate Pro configuration below can be used to create a SIP URI Music on Hold (MOH) server. This solution does not provide a Music on Hold server that requires an RTP stream URI.

This CG/PL code and CommuniGate Pro configuration has been tested and confirmed fuctional with a Linksys SPA-941 IP phone with firmware 4.1.12(a).

Create the following CG/PL script named mohserver.sppr:




// mohserver.sppr
// Accept an incoming call (stop if it's not possible)
// Play the PressPound media file
// Wait for any input for up to 5 seconds
// If the "pound" ("#") symbol was entered,
// play the Good media file - The audio file in this example is named MOH-Music.wav
// Stop

entry Main is
if AcceptCall() != null then stop; end if;
while isConnected() loop
PlayFile ("MOH-Music");
end loop;
end entry;




CommuniGate Pro Configuration for MOH

1. Upload the application and WAV file to the CommuniGate ProPBX where you wish to deliver the MOH service. In this example I use the root PBX of the main domain.

fetch.php

2. Create a user account called moh (warning you probably wish to create a hard password or disable authentication for this account as a person will not use it, but you do not want is easily accessable)

fetch.php

3. Use the simplified Real-Time Rule Divert Calls in the moh@domain.com account to redirect all calls to #mohserver

fetch.php

Linksys SPA-941 IP Phone Configuration

1. Connect to the phone advanced administration interface page

fetch.php

2. Locate the Field MOH Server on Ext 1 or 2 and add the moh SIP URI this field

fetch.php

To test this service place a call from the IP phone or receive a call on the IP Phone and use the IP phone to put the call on hold. The music should begin for the other party shortly after the hold button is selected.