B
B
B1ackGh0st2019-04-16 12:20:22
PHP
B1ackGh0st, 2019-04-16 12:20:22

Is there such a possibility?

Kind !
There is a page on the company's internal website, where phone numbers are listed in the contacts section. Is it possible to implement this: ON the page click on the number and your physical SIP phone dials the number?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Michael, 2019-04-16
@B1ackGh0st

I have it implemented through Asterisk ami.
Call code via asterisk ami in php:

$ami_param = array(
  'hostname'		=> '<IP_адрес_asterisk>',
  'port'			=> '5038',
  'username'		=> '<ami_username>',
  'password'		=> '<ami_password>',
  'wait_time'		=> '60000',
  'priority'		=> '1',
);

// Выполняем звонок
$oSocket = fsockopen($ami_param['hostname'], $ami_param['port'], $errnum, $errdesc) or die("Connection to host failed");
sleep(1);
fputs($oSocket, "Action: login\r\n");
fputs($oSocket, "Events: off\r\n");
fputs($oSocket, "Username: ".$ami_param['username']."\r\n");
fputs($oSocket, "Secret: ".$ami_param['password']."\r\n\r\n");

fputs($oSocket, "Action: originate\r\n");
fputs($oSocket, "Channel: SIP/".$command['number_src']."\r\n");
fputs($oSocket, "Timeout: ".$ami_param['wait_time']."\r\n");
fputs($oSocket, "Context: ".$ami_param['context']."\r\n");
fputs($oSocket, "CallerId: ".$command['number_src']."\r\n");
fputs($oSocket, "Exten: ".$command['number_dst']."\r\n");
fputs($oSocket, "Priority: ".$ami_param['priority']."\r\n");
fputs($oSocket, "Async: yes\r\n\r\n");
fputs($oSocket, "Action: Logoff\r\n\r\n");
sleep(1);
fclose($oSocket);

As a result, I get: the user presses the button, an alert is thrown out to him about what will happen now, then there is a call to the user's phone (taken from the database of the corporate site), and then to the required number.
Attention! Make a bunch of checks on the outgoing number so as not to get into the loot.

G
Gansterito, 2019-04-16
@Gansterito

In Yealink, for example, such a function is called Action URL. It works regardless of the type of PBX (asterisk, cloud).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question