StarTrinity.com

Measuring quality

Here are some open-source examples of VoIP autodialer implementation in CallXML language. The scripts are executed by StarTrinity softswitch.

VoIP autodialer script #1

  • Make calls according to schedule - during daytime
  • Enumerate N destination GSM gateways (GoIP, DINSTAR, any SIP-compatible)
  • Play audio file when call is answered
  • Don't make second call to the same number at one time
  • Count attempts, make maximum N attempts. Make a pause before redialing
<callxml>
 <checktime>
  <span weekdays="mon,tue,wed,thu,fri,sat,sun" daystart="09:00" daystop="13:00" /> <!-- work days, 9AM ... 1PM -->
  <span weekdays="mon,tue,wed,thu,fri,sat,sun" daystart="14:00" daystop="23:00" /> <!-- work days, 2PM ... 6PM -->
 </checktime>
 <on event="time_matches" >
  <assign var="file" value="C:\Users\Public\Music\Sample Music\Sleep Away.mp3" /> <!-- file name in 1 place for all 3 attempts -->
  <assign var="destinationIp" values="192.168.0.201;192.168.0.202;192.168.0.203" /> <!-- enumerate gateway IP's -->
  <readcsv value="C:\StarTrinity\numbers.csv" repeat="infinite" var0="number" />
  <log value="read number from csv: $number;" />
  <assign var="attempt" value="1" />

  <log label="make_call" value="going to make call... $number;@$destinationIp; attempt #$attempt;" />
  <ifcallexists calledId="$number;" >
   <log value="not making call to $number; - some other call already in progress" />
   <exit />
  </ifcallexists>

  <call maxringtime="60s" callerId="test" value="sip:$number;@$destinationIp;" />
 </on>
 <on event="answer">
  <log value="number $number;@$destinationIp; answered (attempt #$attempt;)" />
  <playaudio value="$file;" repeat="10000" maxtime="120s" />
  <exit />
 </on>
 <on event="callfailure;maxringtime">
  <log value="call to $number;@$destinationIp; failed (attempt #$attempt;) with status $lastError;" />
  <assign var="attempt" mathvalue="$attempt;+1" />
  <if test="$attempt; &lt; 4">
   <log value="waiting some time and retrying (attempt #$attempt;)...." />
   <wait value="30s" />
   <goto value="make_call" />
  </if>
 </on>
</callxml>

VoIP autodialer script #2

  • Read A and B number from CSV file
  • Make a call to VoIP trunk, use G.729 codec
  • Save result of dialing to MySQL database via ODBC driver
  • When call is answered, play sound file and busy signal
<callxml>
 <readcsv value="C:\list.csv" var0="a" var1="b" />
 <call callerId="$a;" value="sip:$b;@193.15.24.5" codec="G729" maxringtime="10s" maxansweredtime="$rand(1000,10000);s" />
 <on event="maxansweredtime">
  <requestdb odbcConnection="Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=voipswitch; User=root; Password=xxxyyyyzzz;">
    insert into `answered_numbers` (`number`) values ($calledId;)
  </requestdb>
  <exit />
 </on>
 <on event="answer">
  <playaudio value="c:\sound.mp3" />
  <playaudio value="c:\busy.mp3" repeat="infinite" />
 </on>
</callxml>
Copyright 2011-2024 StarTrinity.com | Blog | Contact lead developer via LinkedIn |