BẠN CÓ THỂ THỰC HIỆN TÍNH NĂNG NÀY VỚI STRINGEE API
CHỈ TRONG 15 PHÚT

Gọi 02499966600 từ điện thoại của bạn và nhấn phím 1234#, cuộc gọi sẽ đổ vào Softphone bên dưới
$from = $_GET['from'];
$to = $_GET['to'];
$postDataFromStringee = file_get_contents('php://input');

if(!$postDataFromStringee){
	$eventUrl = "https://v1.stringee.com/demo/landingpage_demo/stringee_demo.php?from=$from&to=$to";
	$sccos = '[{
	        "action": "talk",
	        "text": "Cảm ơn bạn đã dùng thử dịch vụ của Stringee, vui lòng nhập 4 chữ số máy lẻ và nhấn phím thăng!",
	        "voice": "hn_female_thutrang_phrase_48k-hsmm",
	        "silenceTime": 2000
	    },
	    {
	        "action": "input",
	        "eventUrl": "' . $eventUrl . '",
	        "submitOnHash": true,
	        "timeout": "15"
	    }
	]';
} else {
	$postDataFromStringee = json_decode($postDataFromStringee, true);
	$dtmf = $postDataFromStringee['dtmf'];

	$userId = 'demo_' . $dtmf;

	$sccos = '[{
	        "action": "connect",
	        "from": {
				"type": "external",
				"number": "' . $from . '",
				"alias": "' . $from. '"
			},
			"to": {
				"type": "internal",
				"number": "' . $userId . '",
				"alias": "' . $to . '",
			},
	    }
	]';
}

echo $sccos;                                
var config = {
	arrowDisplay: 'none',
	fromNumbers: [{alias: 'Not available', number: 'Not available'}],
	askCallTypeWhenMakeCall: false,
	appendToElement: 'wrap-softphone-demo'
};

StringeeSoftPhone.on('requestNewToken', function () {
	StringeeSoftPhone.connect(access_token);
});
StringeeSoftPhone.init(config);
StringeeSoftPhone.connect(access_token);
                            
1. Người dùng gọi vào số: 02499966600

2. StringeeServer (HTTP GET) ==> YourServer, YourServer trả về kết quả:
	[{
		"action": "talk",
		"text": "Cảm ơn bạn đã dùng thử dịch vụ của Stringee, vui lòng nhập 4 chữ số máy lẻ và nhấn phím thăng!",
		"voice": "hn_female_thutrang_phrase_48k-hsmm",
		"silenceTime": 2000
	}, {
		"action": "input",
		"eventUrl": "https://v1.stringee.com/demo/landingpage_demo/stringee_demo.php?from=84901701***&to=84865221779",
		"submitOnHash": true,
		"timeout": "15"
	}]

3. Người dùng nhấn phím: 1234#

4. StringeeServer (HTTP POST) ==> YourServer:

	a. Post data

		{
			"time": "1537198677761",
			"dtmf": "1234",
			"call_id": "call-vn-1-214SDLEP4F-1536793871344",
			"customField": "",
			"timeout": false,
			"projectId": 888
		}

	b. YourServer trả về kết quả:

		[{
			"action": "connect",
			"from": {
				"type": "external",
				"number": "84901701***",
				"alias": "84901701***"
			},
			"to": {
				"type": "internal",
				"number": "demo_1234",
				"alias": "84865221779",
			},
		}]
                            

Khách hàng tiêu biểu