How to configure auto-dial using call data from sql server

Hi all,

I need support to configure auto-dial using data from sql server.

Regards,
Nani

The Method I use PHP and AMI Originate Action

Hi,

Thank you for quick reply.
Can you please brief me the process how to configure and how it will work.

Requirement is to get call data from sql server and asterisk server has to do auto dial.

Regards,
Nani

  1. Connection to MMSQL and fetch the database data
    http://php.net/manual/en/book.uodbc.php

  2. Create a socket connection to the Asterisk Manager
    http://php.net/manual/en/function.fsockopen.php

  3. Originate the call

https://wiki.asterisk.org/wiki/display/AST/Asterisk+16+ManagerAction_Originate

Hi,

I want to auto dial a number and play IVR. But my IVR is starting before called party answer the phone.

Regards,

Nani

There is a lot of detail missing here, but I suspect you are using originate or call files to a an analogue line without proper answer supervision from the network, or with Asterisk not configured to wait for answer supervision.

Asterisk doesn’t wait for analogue reversals, by default, as, if the network didn’t provide them, the call would never complete.

2 Likes

Hi,

I am using call files to auto dial.

Here is my call file and extension.conf file configuration

Call file:

Channel: DAHDI/g0/XXXXXXXXXX
Callerid: XXXXXXXXXX
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: outboundmsg1
Extension: s
Priority: 1
EOF

extension.conf

[outboundmsg1]

exten => s,1,Set(ODBC_SAVE_CDR()={clid},{src},{dst},{dcontext},{channel},{dstchannel},{lastapp},{lastdata},{start},{answer},{end},{duration},{billsec},{disposition},{amaflags},{accountcode},{uniqueid},{userfield},${sequence})

exten => s,n,Set(TIMEOUT(digit)=5)

exten => s,n,Set(TIMEOUT(response)=10)

exten => s,n,Answer

exten => s,n,Wait(1)

exten => s,n,Background(./custom/Main_Menu)

exten => s,n,Read(NUMBER,1,3,3)
exten => s,n,verbose({NUMBER}) exten => s,n,Set(CDR(userfield)={NUMBER})

exten => 1,1,Goto(s,6)

exten => 2,1,Goto(msgack,s,1)

exten => i,1,Playback(./custom/Invalid_Option)
exten => i,2,Hangup
exten => t,1,Playback(./custom/No_Option)
exten => t,2,Hangup

[msgack]

exten => s,1,Playback(./custom/Thank_You)

exten => s,2,Hangup

Hi all,

Now I am getting IVR after answering the call for one service provider but remaining service providers it’s starting before answering the call.

I used AMD and Waitforsilence applications to get this done.

Hi all,

Please help me on this.

I am getting IVR after answering the call for one service provider but remaining service providers it’s starting before answering the call.

Please find the below logs for working and not working scenarios.

Not working logs:

DAHDI/3-1 answered
– Executing [s@IVR:1] Set(“DAHDI/3-1”, “ODBC_SAVE_CDR()=,”) in new stack
[Feb 23 18:52:08] WARNING[9504][C-00000006]: func_odbc.c:476 execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘,)’ at line 1 (204)
[Feb 23 18:52:08] WARNING[9504][C-00000006]: func_odbc.c:485 execute: SQL Exec Direct failed (-1)![INSERT INTO CDR_Report VALUES (,)]
– Executing [s@IVR:2] AMD(“DAHDI/3-1”, “”) in new stack
– AMD: DAHDI/3-1 9010012162 (N/A) (Fmt: ulaw)
– AMD: initialSilence [2500] greeting [1500] afterGreetingSilence [800] totalAnalysisTime [5000] minimumWordLength [100] betweenWordsSilence [50] maximumNumberOfWords [2] silenceThreshold [256] maximumWordLength [5000]
– AMD: Channel [DAHDI/3-1]. Changed state to STATE_IN_SILENCE
– AMD: Channel [DAHDI/3-1]. Word detected. iWordsCount:1
– AMD: Channel [DAHDI/3-1]. Detected Talk, previous silence duration: 2160
– AMD: Channel [DAHDI/3-1]. Changed state to STATE_IN_SILENCE
– AMD: Channel [DAHDI/3-1]. Detected Talk, previous silence duration: 180
– AMD: Channel [DAHDI/3-1]. Word detected. iWordsCount:2
– AMD: Channel [DAHDI/3-1]. Changed state to STATE_IN_SILENCE
– AMD: Channel [DAHDI/3-1]. HUMAN: silenceDuration:800 afterGreetingSilence:800
– Executing [s@IVR:3] GotoIf(“DAHDI/3-1”, “1?humn:mach”) in new stack
– Goto (IVR,s,15)
– Executing [s@IVR:15] WaitForSilence(“DAHDI/3-1”, “1000”) in new stack
– Waiting 1 time(s) for 1000ms of silence with 0s timeout
– Exiting with 1000ms of silence >= 1000ms required
– Executing [s@IVR:16] BackGround(“DAHDI/3-1”, “./custom/Main_Menu”) in new stack
– <DAHDI/3-1> Playing ‘./custom/Main_Menu.gsm’ (language ‘en’)

Working logs:

DAHDI/3-1 answered
– Executing [s@IVR:1] Set(“DAHDI/3-1”, “ODBC_SAVE_CDR()=,”) in new stack
[Feb 23 18:55:55] WARNING[9734][C-00000001]: func_odbc.c:476 execute: SQL Execute returned an error -1: 42000: [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘,)’ at line 1 (204)
[Feb 23 18:55:55] WARNING[9734][C-00000001]: func_odbc.c:485 execute: SQL Exec Direct failed (-1)![INSERT INTO CDR_Report VALUES (,)]
– Executing [s@IVR:2] AMD(“DAHDI/3-1”, “”) in new stack
– AMD: DAHDI/3-1 9110578944 (N/A) (Fmt: ulaw)
– AMD: initialSilence [2500] greeting [1500] afterGreetingSilence [800] totalAnalysisTime [5000] minimumWordLength [100] betweenWordsSilence [50] maximumNumberOfWords [2] silenceThreshold [256] maximumWordLength [5000]
– AMD: Channel [DAHDI/3-1]. Changed state to STATE_IN_SILENCE
– AMD: Channel [DAHDI/3-1]. Word detected. iWordsCount:1
– AMD: Channel [DAHDI/3-1]. Detected Talk, previous silence duration: 2420
– AMD: Channel [DAHDI/3-1]. ANSWERING MACHINE: voiceDuration:1500 greeting:1500
– Executing [s@IVR:3] GotoIf(“DAHDI/3-1”, “0?humn:mach”) in new stack
– Goto (IVR,s,4)
– Executing [s@IVR:4] WaitForSilence(“DAHDI/3-1”, “1000”) in new stack
– Waiting 1 time(s) for 1000ms of silence with 0s timeout

After this call is waiting till end user answers the call and then it’s waiting for 1000 ms to play the IVR.

Regards,

Nani