User Edit
از این سرویس برای ویرایش داخلی استفاده میشود.
#
پارامترهاتوضیحات | داده های تعریف شده | داده های نمونه | پارامترهای ضروری[**]/منطقی[*] | پارامترها |
---|---|---|---|---|
شناسه داخلی که از طریق سرویس جستجو بدست می آید | - | 603b41443e14270c550bf15a | ** | id_ |
فعال/غیرفعال بودن کاربر | yes/no | yes | * | active |
نامکاربر | - | Test User | * | name |
شمارهداخلی | - | 530 | * | number |
- | - | 530 | * | cid_number |
رمزعبور | - | 530 | * | secret |
ظبط مکالمات | yes/no | no | * | call_record |
- | yes/no | no | * | push_notification |
IPهای غیر مجاز | - | 0.0.0.0/0.0.0.0 | * | deny |
IPهای مجاز | - | 0.0.0.0/0.0.0.0 | * | permit |
پروتکل dtmf | - | rfc2833 | * | dtmfmode |
- | yes/no | no | * | canreinvite |
- | yes/no | no | * | directmedia |
- | - | main_routing | * | context |
- | - | dynamic | * | host |
- | User/Peer/Friend | user | * | type |
- | yes/no/Force Report & Co-Media | no | * | nat |
- | - | 5060 | * | port |
- | yes/no | no | * | qualify |
- | - | 1 | * | callgroup |
- | - | 1 | * | pickupgroup |
- | yes/no | no | * | callcounter |
- | yes/no | no | * | faxdetect |
- | - | - | * | call_limit |
- | yes/no | no | * | trunk |
- | yes/no | no | * | transfer |
- | - | - | ||
- | - | 571 | forward_policy->Busy | |
- | - | 09158315762 | forward_policy->No Answer | |
- | - | 570 | forward_policy->UnAvailable | |
- | - | 2121 | forward_policy->All | |
- | - | 2121 | forward_policy->All |
#
نمونه خروجی درخواست{ "success": 1, "message": "Requested operation is done successfully", "data": "", "old": { "_id": { "$oid": "603b41443e14270c550bf15a" }, "user_type": "SIP", "active": "yes", "name": "Test User", "number": "530", "cid_number": "530", "secret": "530", "call_record": "no", "push_notification": "no", "deny": "0.0.0.0/0.0.0.0", "permit": "0.0.0.0/0.0.0.0", "dtmfmode": "rfc2833", "canreinvite": "no", "directmedia": "no", "context": "main_routing", "host": "dynamic", "type": "user", "nat": "no", "port": "5060", "qualify": "no", "callgroup": "1", "pickupgroup": "1", "callcounter": "no", "faxdetect": "no", "call_limit": "", "trunk": "no", "transfer": "no", "email": "", "forward_policy": { "Busy": "571", "No Answer": "09158315762", "UnAvailable": "570", "All": "2121" }, "more_options": "", "date": { "$date": { "$numberLong": "1614496068018" } } }}
#
نمونه فراخوانی- PHP
- JS
- Linux
<?php$curl = curl_init();
curl_setopt_array($curl, array( CURLOPT_URL => 'http://192.168.51.20//api/v3/pbx/users', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS =>'{ "_id":"6033876dc92de036d1390923", "user_type":"SIP", "active":"yes", "name":"Test User", "number":"999", "cid_number":"999", "secret":"999", "call_record":"no", "push_notification":"no", "deny":"0.0.0.0/0.0.0.0", "permit":"0.0.0.0/0.0.0.0", "dtmfmode":"rfc2833", "canreinvite":"no", "directmedia":"no", "context":"main_routing", "host":"dynamic", "type":"user", "nat":"no", "port":"5060", "qualify":"no", "callgroup":"1", "pickupgroup":"1", "callcounter":"no", "faxdetect":"no", "call_limit":"", "trunk":"no", "transfer":"no", "email":"", "forward_policy":{"Busy":"571","No Answer":"093411452671","UnAvailable":"588","All":"2020"}, "more_options":"" }',CURLOPT_HTTPHEADER => array( 'X-APIKEY: vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG', 'Authorization: Basic dGVzdDpBYTEyMzQ1Ng==', 'Content-Type: application/json'),));
$response = curl_exec($curl);
if (!curl_errno($curl)) { $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE); echo 'response code:'.$httpcode, '<br/>';}
curl_close($curl);echo $response;
<html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head>
<body> <script> var settings = { "url": "http://192.168.51.20/api/v3/pbx/users", "method": "PUT", "timeout": 0, "headers": { "X-APIKEY": "vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG", "Authorization": "Basic dGVzdDpBYTEyMzQ1Ng==", "Content-Type": "application/json" }, "data": JSON.stringify({ "_id": "603b41443e14270c550bf15a", "user_type": "SIP", "active": "yes", "name": "Test User", "number": "530", "cid_number": "530", "secret": "530", "call_record": "no", "push_notification": "no", "deny": "0.0.0.0/0.0.0.0", "permit": "0.0.0.0/0.0.0.0", "dtmfmode": "rfc2833", "canreinvite": "no", "directmedia": "no", "context": "main_routing", "host": "dynamic", "type": "user", "nat": "no", "port": "5060", "qualify": "no", "callgroup": "1", "pickupgroup": "1", "callcounter": "no", "faxdetect": "no", "call_limit": "", "trunk": "no", "transfer": "no", "email": "", "forward_policy": { "Busy": "571", "No Answer": "09158315762", "UnAvailable": "570", "All": "2121" }, "more_options": "" }), };
$.ajax(settings).always(function (jqXHR) { console.log("response code: " + jqXHR.status + " " + jqXHR.statusText); console.log("response body: " + jqXHR.responseText); }); </script> </body></html>
curl --location --request PUT 'http://192.168.51.20/api/v3/pbx/users' \--header 'X-APIKEY: vZKtIKWsld0egNlkzHo8i5LVBqLNBSWARCQsPOSgDjFmAHM3tG' \--header 'Authorization: Basic dGVzdDpBYTEyMzQ1Ng==' \--header 'Content-Type: application/json' \--data-raw '{"_id":"603f4ea7fcff3269187a3da3","user_type":"SIP","active":"yes","name":"Test User2","number":"909","cid_number":"909","secret":"909","call_record":"no","push_notification":"no","deny":"0.0.0.0/0.0.0.0","permit":"0.0.0.0/0.0.0.0","dtmfmode":"rfc2833","canreinvite":"no","directmedia":"no","context":"main_routing","host":"dynamic","type":"user","nat":"no","port":"5060","qualify":"no","callgroup":"1","pickupgroup":"1","callcounter":"no","faxdetect":"no","call_limit":"","trunk":"no","transfer":"no","email":"","forward_policy":{"Busy":"571","No Answer":"09158315762","UnAvailable":"570","All":"2121"},"more_options":""}'