D
D
Denis Zh2015-11-25 13:22:09
Asterisk
Denis Zh, 2015-11-25 13:22:09

How to organize a callback directly to the subscriber's internal number?

Good afternoon, there is a task on pure Asterisk to organize a callback from a landline, cellular to an internal subscriber number,
That is, when an internal subscriber of the company calls a landline, mobile (client) and they do not pick up the phone there, this entry is entered into the database, after that the external client (who did not pick up the phone) calls back to the company's landline number (which is in his phone in missed calls) hears in the IVR a proposal to press the 0 button to immediately call the last subscriber who dialed him (thus it does not load the secretaries who are now the poor looking for who dialed this or that client) of the company that called him, or if the client calls for the first time to the company, then it turns on standard IVR where it is proposed to simply dial an internal number or wait for the answer of the secretary .. Perhaps this should be done by a script, perhaps just writing to the dial plan. Help???

Answer the question

In order to leave comments, you need to log in

6 answer(s)
O
O. J, 2015-11-25
@OrlovEvgeny

Google towards AGI
In short, you track and write to the database the outgoing numbers of the subscribers you tried to call + the internal number from which they called. Further, when the subscriber decides to call you back, in the dialplan with the line exten => t,n,AGI(exemple.php); the script you wrote exemple.php will be called, which in turn will go to the database and check whether they tried to reach this subscriber.

D
Denis Sh, 2015-11-25
@Deq56

something like this
Outgoing routing
context out {
_X. =>{
Dial(SIP/[email protected]);
};
h=>{
if ("${CDR(disposition)}"="NO ANSWER") {
&resultat_sql(%${CALLERID(num)}, ${EXTEN}, 0);
};
if ("${CDR(disposition)}" = "BUSY") {
&resultat_sql(%${CALLERID(num)}, ${EXTEN}, 0);
};
};
h=>{
if ("${CDR(disposition)}"="NO ANSWER") {
&resultat_sql(${EXTEN}, status);
};
if ("${CDR(disposition)}" = "BUSY") {
&resultat_sql(${EXTEN}, status);
};
};
};
MYSQL(Connect connid localhost user pass DB);
MYSQL(Query resultid ${connid} INSERT INTO out_call VALUE num_out=${num_out} num_to=${num_to} status=${status});
MYSQL(Clear${resultid});
MYSQL(Disconnect ${connid});
};
Inbound routing
context in {
_X. =>{
MYSQL(Connect connid localhost user pass DB)
MYSQL(Query resultid ${connid} select num_out from out_call where num_to LIKE '%${CALLERID(num):2}%' status '0' limit 1)
MYSQL(Fetch fetchid ${resultid} NUMBER_TO_DIAL)
if (${EXIST(${NUMBER_TO_DIAL})}){
Dial(Local/${NUMBER_TO_DIAL});
}
else{
normal call flow
};
};
h =>{
MYSQL(Connect connid localhost user pass DB);
MYSQL(Query resultid ${connid} UPDATE out_call SET status='1' where num_to like '%${CALLERID(num):2}%' );
MYSQL(Clear${resultid});
MYSQL(Disconnect ${connid});
};
};

D
Dmitry Skogorev, 2015-11-25
@EnterSandman

This can be done by a script, it can also be done by a macro in the dialplan...
Accordingly, I would turn to freelancers (contact me, I will help =))
you need to process an outgoing call and, if the statuses are busy / noanswer / cancel, I would write to the database,
respectively, when incoming on calls, match the caller's CID from the database and perform the necessary actions

D
Denis Zh, 2015-11-25
@Daios

Is it possible to send an example of a similar script to the studio for reflection and analysis? Yes, Asterisk is clean! on Ubuntu not Elastix..etc

I
Ivan Baidin, 2015-11-25
@zeronice

It is enough to use the built-in asterisk BD.
Use DIALSTATUS for an outgoing call and when receiving a BUSY, enter the subscriber number from ${EXTEN} and the CALLERID of the calling employee
into the database, and in the processing of incoming calls, the macro for the presence of the subscriber in the database is displayed. in the macro, implement the same IVR and delete the entry from the database

R
Rsa97, 2015-11-25
@Rsa97

It's easy to do, there are only a couple of small nuances.
If you call a cell phone via an analog city line and the subscriber has music turned on instead of beeps, then the analysis of the call state (callprogress in dahdi) is lost, respectively, Asterisk considers that he has already been answered, although the subscriber did not pick up the phone. Accordingly, in this case, it is easier to enter all calls into the database and offer the subscriber to switch to the last one he spoke with.
If you call a short cell phone number, the call back will contain the full cell number. It is necessary either to make a table of correspondences, or to decide at the organizational level.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question