-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
40 lines (26 loc) · 870 Bytes
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// This is not a source code but only a simulation, if you want to get real time dtmf digits from your client or anyone then you must buy our bot.
<?php
function generateSIPWithDTMF() {
// Mock SIP INVITE message
$sip_invite = <<<SIP
INVITE sip:[email protected] SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5060;branch=z9hG4bK123456
Max-Forwards: 70
From: <sip:[email protected]>;tag=client
To: <sip:[email protected]>
Call-ID: 1234567890
CSeq: 1 INVITE
Contact: <sip:[email protected]>
Content-Type: application/sdp
Content-Length: 0
SIP;
// Add DTMF tones to the SIP message
$sip_message = $sip_invite . "\n";
foreach ($dtmf_tones as $dtmf) {
$sip_message .= $dtmf . "\n";
}
$full_sip_interaction = $sip_message . "\n" . $sip_response . "\n" . $sip_ack . "\n" . $sip_bye;
return $full_sip_interaction;
}
echo generateSIPWithDTMF();
?>