-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathindex.php
1102 lines (661 loc) · 27 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/* THIS IS JUST AN EXAMPLE */
require("config.php");
require("functions.php");
if (!isset($_GET["username"]))
error('No username');
$username = $_GET["username"];
if (!isset($_GET["password"]))
error('No password');
$password = $_GET["password"];
if (!isset($_GET["version"])) {
$version = '1.0';
} else {
$version = $_GET["version"];
}
// 1. Check the username and password
$res = validate_user($username, $password);
if (!$res)
error("Wrong username or password");
if (ver_to_int($version) === ver_to_int("1.0") ) {
// 2. If the credentials are correct and the version is 1.0 send the following config
$xml = new DOMDocument("1.0", "UTF-8");
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$options = $xml->createElement("options");
$accounts = $xml->createElement("accounts");
$account = $xml->createElement("account");
$element = $xml->createElement("username", $username);
$account->appendChild($element);
$element = $xml->createElement("password", $password);
$account->appendChild($element);
$element = $xml->createElement("tech", 0);
$account->appendChild($element);
$element = $xml->createElement("host", SIP_DOMAIN);
$account->appendChild($element);
$element = $xml->createElement("port", "5060");
$account->appendChild($element);
$element = $xml->createElement("outbound_proxy", 0);
$account->appendChild($element);
$element = $xml->createElement("use_outbound_proxy", 0);
$account->appendChild($element);
$element = $xml->createElement("outbound_proxy_port", "5060");
$account->appendChild($element);
$element = $xml->createElement("register_on_startup", 1);
$account->appendChild($element);
$element = $xml->createElement("context", "");
$account->appendChild($element);
$element = $xml->createElement("reregistration_time", 60);
$account->appendChild($element);
$element = $xml->createElement("transport_type", 0);
$account->appendChild($element);
$element = $xml->createElement("use_stun", 0);
$account->appendChild($element);
$element = $xml->createElement("stun_host", "");
$account->appendChild($element);
$element = $xml->createElement("stun_port", 3478);
$account->appendChild($element);
$element = $xml->createElement("stun_refresh_period", "");
$account->appendChild($element);
$element = $xml->createElement("use_rport", 1);
$account->appendChild($element);
$element = $xml->createElement("use_rport_media", 0);
$account->appendChild($element);
$element = $xml->createElement("dtmf_style", 0);
$account->appendChild($element);
$accounts->appendChild($account);
$options->appendChild($accounts);
$codecs = $xml->createElement("codecs");
$codec = $xml->createElement("codec");
$element = $xml->createElement("codec_id", 27);
$codec->appendChild($element);
$element = $xml->createElement("name", "iLBC30");
$codec->appendChild($element);
$element = $xml->createElement("priority", 5);
$codec->appendChild($element);
$element = $xml->createElement("selected", 1);
$codec->appendChild($element);
$codecs->appendChild($codec);
$options->appendChild($codecs);
$xml->appendChild($options);
echo $xml->saveXML($xml, LIBXML_NOEMPTYTAG);
}
elseif (ver_to_int($version) > ver_to_int("1.0") ) {
// 3. If the credentials are correct and the version is greater than 1.0 send the following config
/* NOTE: This example is prepared according to the latest provisioning configuration implemented in Zoiper,
In case the application has implemented an older version than the one in this example, then it will skip the newly added
parameters and provision only these that are supported.*/
$xml = new DOMDocument("1.0", "UTF-8");
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$options = $xml->createElement("options");
/* Possible values: string,
Version of the provisioning XML.*/
$element = $xml->createElement("prov_version", "1.14");
$options->appendChild($element);
/* Possible values: string,
Optional unique customer ID.*/
$element = $xml->createElement("customer_sid", "");
$options->appendChild($element);
/* Possible values: string,
Optional unique provisioning ID.*/
$element = $xml->createElement("prov_id", "");
$options->appendChild($element);
/* Possile values: string,
Optional name of the provisioning profile.*/
$element = $xml->createElement ("prov_name", "");
$options->appendChild($element);
/* Accounts holds account nodes for each provisioned account.
Only one per provisionin xml.*/
$accounts = $xml->createElement("accounts");
/* Account contains a complete account configuration.*/
$account = $xml->createElement("account");
/* Identifier of the account. Unique and not changeble.*/
$element = $xml->createElement("ident");
$account->appendChild($element);
/* Possible values: string,
Account display name.*/
$element = $xml->createElement("name", "Account1");
$account->appendChild($element);
/* Possible values: string,
Username.*/
$element = $xml->createElement("username", $username);
$account->appendChild($element);
/* Possible values: string,
Password.*/
$element = $xml->createElement("password", $password);
$account->appendChild($element);
/* Possible values: true, false ;
Controls startup registration of the account. */
$element = $xml->createElement("register_on_startup", true);
$account->appendChild($element);
/* Possible values: true, false ;
Controls the use of push notifications. */
$element = $xml->createElement("enable_push_notifications", true);
$account->appendChild($element);
/* Possible values: true, false ;
Optional enabales ring-back tones.*/
$element = $xml->createElement("do_not_play_ringback_tones", true);
$account->appendChild($element);
/* Possible values: string ;
Optional voice mail extension.*/
$element = $xml->createElement("voicemail_check_extension", "");
$account->appendChild($element);
/* Possible values: string ;
Optional voice mail transfer extension.*/
$element = $xml->createElement("voicemail_transfer_extension", "");
$account->appendChild($element);
/* Possible values: true, false ;
Optional, forces rfc3264.*/
$element = $xml->createElement("force_rfc3264", true);
$account->appendChild($element);
/* Possible values: true, false;
Optional enables kpml.*/
$element = $xml->createElement("use_kpml", true);
$account->appendChild($element);
/* Possible values: true, false
Optional enables overlap dialing.*/
$element = $xml->createElement("use_overlap_dialing", true);
$account->appendChild($element);
/* Possible values: true, false
Optional enables custom ringtone.*/
$element = $xml->createElement("use_custom_ringtone", true);
$account->appendChild($element);
/* Possible values: string
Optional custom ring-tone uri*/
$element = $xml->createElement("custom_ringtone_location", "");
$account->appendChild($element);
/* Possible values: none, common, location, configuration, self_signed
Optional custom certificate usage.*/
$element = $xml->createElement("use_custom_certificate", "");
$account->appendChild($element);
/* Possible values: string
Optional custom certificate uri.*/
$element = $xml->createElement("custom_certificate_location", "");
$account->appendChild($element);
/* Possible values: string
Optional custom certificate data.*/
$element = $xml->createElement("custom_certificate", "");
$account->appendChild($element);
/* Possible values: disabled, before, after, both
Optional message waiting indication subscription.*/
$element = $xml->createElement("mwi_subscribe_usage", "disabled");
$account->appendChild($element);
/* Possible values: true, false
Optional enables number rewriting.*/
$element = $xml->createElement("use_number_rewriting", true);
$account->appendChild($element);
/* Possible values: string, auto-detect
Optional specifies country code to be applied to numbers without such one.*/
$element = $xml->createElement("number_rewriting_country", "");
$account->appendChild($element);
/* Possible values: string
Optional enables number rewriting with custom dialout prefix.*/
$element = $xml->createElement("number_rewriting_prefix", "");
$account->appendChild($element);
/* Implemented in XML Configuration v1.6
Possible values: true, false
Optional enables the striping of characters from the dial string.*/
$element = $xml->createElement("use_strip_dial_chars", true);
$account->appendChild($element);
/* Implemented in XML Configuration v1.6
Possible values: string
Optional. The characters that going to be stripped from the dial string.*/
$element = $xml->createElement("strip_dial_chars", ".- ()[]{}");
$account->appendChild($element);
/* Possible values: string
Optional.*/
$element = $xml->createElement("token", "");
$account->appendChild($element);
/* Possible values: string
Optional.*/
$element =$xml->createElement("token_url", "");
$account->appendChild($element);
/* Possible values: string
Optional.*/
$element = $xml->createElement("balance_url", xml_url ('https://example.com/script.php?username=${USERNAME}&password=${PASSWORD}¤cy=${CURRENCY}'));
$account->appendChild($element);
/* Possible values: string
Optional.*/
$element = $xml->createElement("rate_url", xml_url ('https://example.com/script.php?destination=${DESTINATION}¤cy=${CURRENCY}&username=${USERNAME}&password=${PASSWORD}'));
$account->appendChild($element);
/* Implemented in XML Configuration v1.7
Possible values: string
Optional.*/
$element = $xml->createElement("quality_rating_url", xml_url ('https://example.com/script.php?id=${CALL_IDENTIFIER}&rating=${RATING}'));
$account->appendChild($element);
/* Possible values: SIP, IAX2, XMPP, RTSP
Protocol. Controls the presence of configuration blocks: SIP, IAX2*/
$element = $xml->createElement("protocol", "SIP");
$account->appendChild($element);
/* Possible values: default, custom
The default registration refresh should be 600s for TCP and 30s for UDP.
Note that the server might enforce different (shorter) refresh time. The stack
will not wait for the full period to refresh the registration. It will
try to refresh it after 90% of the negotiated time has elapsed.*/
$element = $xml->createElement("reregistration_mode", "default");
$account->appendChild($element);
/* Possible values: unsigned long
Use this to specify the reregistration time when the mode selected is custom.*/
$element = $xml->createElement("reregistration_time", 600);
$account->appendChild($element);
/* Possible values: default, custom
The default subscription refresh should be 1800s for TCP and UDP.*/
$element = $xml->createElement("resubscription_mode", "default");
$account->appendChild($element);
/* Possible values: unsigned long
Optional.*/
$element = $xml->createElement("resubscription_time", "1800");
$account->appendChild($element);
/* Possible values: string
Configures the user domain.*/
$element = $xml->createElement("SIP_domain", SIP_DOMAIN);
$account->appendChild($element);
/* Possible values: true, false
Optional use outbound proxy.*/
$element = $xml->createElement("SIP_use_outbound_proxy", true);
$account->appendChild($element);
/* Possible values: string
Optional SIP proxy server to force instead of the automatically detected one.*/
$element = $xml->createElement("SIP_outbound_proxy", "");
$account->appendChild($element);
/* Possible values: UDP, TCP, TLS
The signalling protocol.*/
$element = $xml->createElement("SIP_transport_type", "UDP");
$account->appendChild($element);
/* Possible values: true, false
Optional use authentication username.*/
$element = $xml->createElement("SIP_use_auth_username", true);
$account->appendChild($element);
/* Possible values: string
Optional username to be used when repsonding to a SIP authentication challenge.*/
$element = $xml->createElement("SIP_auth_username", "");
$account->appendChild($element);
/* Possible values: string
Optional display name.*/
$element = $xml->createElement("SIP_callerId", "");
$account->appendChild($element);
/* Possible values: true, false
This function can be used to discover the public address and port in case
there is a NAT between the user and the server. It also helps for normal
unfirewalled TCP and TLS connections (highly recommended for these two protocols).*/
$element = $xml->createElement("SIP_use_rport", false);
$account->appendChild($element);
/* Possible values: true, false
Enables usage of rport discovered public address for media negotiations.
Can help in some firewall/NAT/VPN setups where the port is not changed,
only the private address is replaced with a public one. When both rport
and STUN are enabled, STUN will be preferred.
This option is not recommended. Enable it only if you absolutely know
what you're doing.*/
$element = $xml->createElement("SIP_use_rport_media", false);
$account->appendChild($element);
/* Possible values: none, SDES
Select the user's SRTP mode.*/
$element = $xml->createElement("SIP_srtp_mode", "none");
$account->appendChild($element);
/* Possible values: inband, rfc+2833, SIP_info_numeric, SIP_info_ascii, disabled
Select the DTMF band for the user.*/
$element = $xml->createElement("SIP_dtmf_style", "rfc_2833");
$account->appendChild($element);
/* Possible values: true, false
Optional, enable busy line field.*/
$element = $xml->createElement("SIP_use_blf", true);
$account->appendChild($element);
/* Possible values: true, false
Optional, publish user presence.*/
$element = $xml->createElement("SIP_publish_presence", true);
$account->appendChild($element);
/* Possible values: true, false
Optional, subscribes for other user's presence.*/
$element = $xml->createElement("SIP_subscribe_presence", true);
$account->appendChild($element);
/* Possible values: disabled, default, custom
Optional.*/
$element = $xml->createElement("SIP_keep_alive_mode", "disabled");
$account->appendChild($element);
/* Possible values: unsigned long
Optional.*/
$element = $xml->createElement("SIP_keep_alive_timeout", 90);
$account->appendChild($element);
/* Implemented in XML Configuration v1.10
Possible values: true, false
Optional, enables preconditions.*/
$element = $xml->createElement("SIP_use_preconditions", true);
$account->appendChild($element);
/* Implemented in XML Configuration v1.12
Possible values: true, false
Optional, enables reg events.*/
$element = $xml->createElement("SIP_use_reg_event", false);
$account->appendChild($element);
/* Possible values: string
The Jabber Id of the user.*/
$element = $xml->createElement("XMPP_JId", "");
$account->appendChild($element);
/* Possible values: string
Optional full name of the XMPP user.*/
$element = $xml->createElement("XMPP_name", "");
$account->appendChild($element);
/* Possible values: string
Optional XMPP connect server.*/
$element = $xml->createElement("XMPP_server", "");
$account->appendChild($element);
/* Possible values: true, false
It governs the usage of the legacy TLS mode for XMPP.*/
$element = $xml->createElement("XMPP_legacy_tls", false);
$account->appendChild($element);
// stun holds stun related settings.
$stun = $xml->createElement("stun");
/* Possible values: disabled, custom, default
In most cases only disabled and custom are used
Controls the use of STUN.*/
$element = $xml->createElement("use_stun", "custom");
$stun->appendChild($element);
/* Possible values: string
Configures the address of the STUN server.*/
$element = $xml->createElement("stun_host", "");
$stun->appendChild($element);
/* Possible values: unsigned int
Configures the port of the STUN server.*/
$element = $xml->createElement("stun_port", 3478);
$stun->appendChild($element);
/* Possible values: unsigned int
Sets the refresh period of the STUN server
Use this function to specify how often to refresh the STUN server.
The default is 30 seconds. The refresh can be used to keep the
NAT mapping alive.*/
$element = $xml->createElement("stun_refresh_period", 40);
$stun->appendChild($element);
$account->appendChild($stun);
/* Possible values: string
Configures the server address.*/
$element = $xml->createElement("IAX2_host", "");
$account->appendChild($element);
/* Possible values: string
Configures the context to be used.*/
$element = $xml->createElement("IAX2_context", "");
$account->appendChild($element);
/* Possible values: string
Optional the display name.*/
$element = $xml->createElement("IAX2_callerId", "");
$account->appendChild($element);
/*Possible values: string
Configures the user name used for identification.*/
$element = $xml->createElement("IAX2_callerNumber", "");
$account->appendChild($element);
/* Possible values: inband, disabled, outband
Select the DTMF band for the user.*/
$element = $xml->createElement("IAX2_dtmf_style", "");
$account->appendChild($element);
/* Implemented in XML Configuration v1.14.
Possible values: true, false
Enable file transfer for the user.*/
$element = $xml->createElement("enable_file_transfer", "");
$account->appendChild($element);
/* Implemented in XML Configuration v1.14.
Possible values: true, false
Enable video fmtp for the user.*/
$element = $xml->createElement("enable_video_fmtp", "");
$account->appendChild($element);
/*msrp holds msrp related settings.*/
$msrp = $xml->createElement("msrp");
/* Implemented in XML Configuration v1.8. Changed in v1.14.
Possible values: true, false
Enable msrp for the user.*/
$element = $xml->createElement("enabled", false);
$msrp->appendChild($element);
/* Implemented in XML Configuration v1.8
Possible values: true, false
Force user to use msrp for chat messages.*/
$element = $xml->createElement("force_msrp_for_chat", false);
$msrp->appendChild($element);
/* Implemented in XML Configuration v1.9
Possible values: true, false
Enables TLS for the MSRP.*/
$element = $xml->createElement("enable_tls", false);
$msrp->appendChild($element);
/* Implemented in XML Configuration v1.8. Changed in v1.14
Possible values: true, false
Enable msrp relay for the user.*/
$element = $xml->createElement("enable_relay", false);
$msrp->appendChild($element);
/* Possible values: string
MSRP relay uri.*/
$element = $xml->createElement("relay_uri", "");
$msrp->appendChild($element);
/* Implemented in XML Configuration v1.8
Possible values: string
Msrp relay username.*/
$element = $xml->createElement("relay_username", "");
$msrp->appendChild($element);
/* Implemented in XML Configuration v1.8
Possible values: string
MSRP relay password.*/
$element = $xml->createElement("relay_password", "");
$msrp->appendChild($element);
$account->appendChild($msrp);
$sms = $xml->createElement("sms");
/* Possible values: true, false
Enables SMS for the user.*/
$element = $xml->createElement("enabled", false);
$sms->appendChild($element);
/* Possible values: true, false
Enables SMS center for the user.*/
$element = $xml->createElement("enable_sms_center", false);
$sms->appendChild($element);
/* Possible values: string
SMS center uri.*/
$element = $xml->createElement("sms_center_uri", "");
$sms->appendChild($element);
$account->appendChild($sms);
/* Codecs holds codec nodes for each supported codec for that.
Only one per provisioning xml.*/
$codecs = $xml->createElement("codecs");
/*Possible values: unsigned int
Internal codec id
Current list:
0 - uLaw
1 - GSM
6 - aLaw
7 - g722
16 - g729
24 - Speex narrow
25 - Speex wide
26 - Speex ultra
27 - iLBC30
28 - iLBC20
29 - g726
31 - VP8
32 - H264
34 - Opus narrow
35 - Opus wide
36 - Opus super
37 - Opus full
*/
$prio = 1;
foreach ($permitcodecs as $c => $p) {
/* Codec contains a codec id, name, priority and if it is enabled. */
$codec = $xml->createElement("codec");
if (empty($codec_ids[$c]))
continue; /* unknown codec */
$cid = $codec_ids[$c];
$element = $xml->createElement("codec_id", $cid);
$codec->appendChild($element);
/* Possible values: unsigned int
Codec priority in media negotiations.*/
$element = $xml->createElement("priority", $prio);
$codec->appendChild($element);
/* Possible values: true, false
Controls if the codec is enabled*/
$element = $xml->createElement("enabled", true);
$codec->appendChild($element);
/* Optional parameters - bps, dtx, vbr
Add them if they're set in $permitcodecs */
if (!empty($p)) {
foreach ($p as $param => $val) {
$element = $xml->createElement($param, $val);
$codec->appendChild($element);
}
}
$codecs->appendChild($codec);
$prio++;
}
$account->appendChild($codecs);
/* Implemented in XML configuration v1.11
ZRTP holds the ZRTP related settings */
$zrtp = $xml->createElement("zrtp");
/* Possible values: true, false
Enables ZRTP. */
$element = $xml->createElement("enabled", false);
$zrtp->appendChild($element);
$hash_algorithms = $xml->createElement("hash_algorithms");
$hash_algorithm = $xml->createElement("hash_algorithm");
/* Possible values: S256, S384
Hash algorithm name.*/
$element = $xml->createElement("name", "S256");
$hash_algorithm->appendChild($element);
/* Possible values:
0 - S256
1 - S384
Hash algorithm id.*/
$element = $xml->createElement("id", 0);
$hash_algorithm->appendChild($element);
/* Possible values: int
Hash algorithm priority.*/
$element = $xml->createElement("priority", 0);
$hash_algorithm->appendChild($element);
/* Possible values: true, false
Controls if the hash algorithm is enabled.*/
$element = $xml->createElement("selected", true);
$hash_algorithm->appendChild($element);
$hash_algorithms->appendChild($hash_algorithm);
$zrtp->appendChild($hash_algorithms);
$cipher_algorithms = $xml->createElement("cipher_algorithms");
$cipher_algorithm = $xml->createElement("cipher_algorithm");
/* Possible values: AES251
Cipher algorithm name.*/
$element = $xml->createElement("name", "S256");
$cipher_algorithm->appendChild($element);
/* Possible values:
0 - AES251
Cipher algorithm id.*/
$element = $xml->createElement("id", 0);
$cipher_algorithm->appendChild($element);
/*Possible values: int
Cipher algorithm priority.*/
$element = $xml->createElement("priority", 0);
$cipher_algorithm->appendChild($element);
/*Possible values: true, false
Controls if the cipher algorithm is enabled.*/
$element = $xml->createElement("selected", true);
$cipher_algorithm->appendChild($element);
$cipher_algorithms->appendChild($cipher_algorithm);
$zrtp->appendChild($cipher_algorithms);
$auth_tags = $xml->createElement("auth_tags");
$auth_tag = $xml->createElement("auth_tag");
/* Possible values: HS32, HS80
Auth tags name.*/
$element = $xml->createElement("name", "HS80");
$auth_tag->appendChild($element);
/* Possible values:
0 - HS32
1 - HS80
Auth tags id.*/
$element = $xml->createElement("id", 1);
$auth_tag->appendChild($element);
/*Possible values: int
Auth tags priority.*/
$element = $xml->createElement("priority", 1);
$auth_tag->appendChild($element);
/*Possible values: true, false
Controls if the Auth tags is enabled.*/
$element = $xml->createElement("selected", true);
$auth_tag->appendChild($element);
$auth_tags->appendChild($auth_tag);
$zrtp->appendChild($auth_tags);
$key_agreement_methods = $xml->createElement("key_agreement_methods");
/* Changed in XML Configuration v1.14 */
$key_agreement_method = $xml->createElement("key_agreement");
/* Possible values: DH2K, EC25, DH3K, EC38
Key agreement name.*/
$element = $xml->createElement("name", "DH2K");
$key_agreement_method->appendChild($element);
/* Possible values:
0 - DH2k
1 - EC25
2 - DH3K
3 - EC38
Key agreement id.*/
$element = $xml->createElement("id", 1);
$key_agreement_method->appendChild($element);
/*Possible values: int
Key agreement priority.*/
$element = $xml->createElement("priority", 0);
$key_agreement_method->appendChild($element);
/*Possible values: true, false
Controls if the Key agreement is enabled.*/
$element = $xml->createElement("selected", true);
$key_agreement_method->appendChild($element);
$key_agreement_methods->appendChild($key_agreement_method);
$zrtp->appendChild($key_agreement_methods);
$sas_encodings = $xml->createElement("sas_encodings");
$sas_encoding = $xml->createElement("sas_encoding");
/* Possible values: B256, B32