MOR API user register
Description
MOR API Create new user from params.
Usage
- Call: /api/user_register
- Methods: POST, GET(if allowed, not recomended)
Parameters
Parameters which are included into hash:
- email - New user email. Required.
- id - User UNIQUEHASH in MOR database. Required. If uniquehash is not used, user will end up at admin account.
Uniquehash can be found in SETTINGS –> Setup –> Settings –> API tab (last setting) or after log out of MOR in the address field of the browser, for example:
http://SERVERIP/billing/callc/login/kljsdfg54kl where kljsdfg54kl is the uniquehash.
- lcr_id
- device_type - Device type [SIP, IAX2, Virtual]. Required.
- username - New user username. Required.
- first_name - New user first name.
- last_name - New user last name.
- caller_id - CallerID for Device (It can include letters, numbers and signs. If empty value is passed CallerID will be used the same as in Default User settings. If empty in Default User settings and in request - it will not be used).
- state
- device_location_id
Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key
Parameters which are not included into hash:
- hash - SHA1 hash constructed using parameters which are listed above. Note that parameters are shown in the same order as they have to be when generating the hash. Last parameter in a row is API_Secret_Key ( More described in Constructing hash). Required.
- password - New user password. Required.
- password2 - New user password confirmation. Required.
- country_id - New user country (please check table below). Required.
- mob_phone - Mobile phone number.
- phone - Phone number.
- fax - Fax.
- client_id - Company/Personal ID.
- vat_number - TAX Registration Number.
- county
- city
- postcode - Postcode/ZIP.
- address
- usertype
- permission_group - Reseller or Accountant Permission Group (depending what usertype is sended)
- accounting_number - Accounting Number
- call_limit - Call limit (how many simultaneous Calls the new User can make by default?)
- credit_limit - Credit limit
- tariff - Tariff ID from database.
- currency_id - Currency ID from database.
- postpaid - If postpaid=1, then User will be created as postpaid. If postpaid =0, then User will be created as prepaid. If parameter is not used, then User will be created according Default User settings.
Request
HTML POST: http://<SERVER_IP>/billing/api/user_register?id=kljsdfg54kl&username=username&password=pass&password2=pass&first_name=first &last_name=last&country_id=10&email=email@email.com&device_type=SIP&hash=sd5g16sd1g6s
Returns
Success
<page> <status> <success>Registration successful</success> </status> <user_device_settings> <email>Registration email</email> - If email sending enabled. <user_id> user id</user_id> <device_type> device type [SIP|IAX2]</device_type> <device_id> device id </device_id> <username> device username </username> <password> device password </password> <pin> device pin </pin> <server_ip> Asterisk Server IP </server_ip> <registration_notice> Registration notice which is set in Settings </registration_notice> </user_device_settings> </page>
Errors
- <error>Incorrect hash</error> - Hash was not correct. Check API_Secret_Key and order or params while concatenating hash_string.
- <error>Registration over API is disabled</error> - Setting: Settings->API->API allow Registration, is off. Turn on API allow Registration.
- <error>Access Denied</error> - User with UNIQUEHASH not found or params id not send. Enter correct id.
- <error>Please enter username</error> - Params username is not send. Enter correct username.
- <error>Enter device type</error> - device_type is not send. Enter correct device_type.
- <error>Such username is already taken</error> - Duplicate of username. Change username.
- <error>Passwords do not match</error> - Enter correct passwords.
- <error>Password must be longer than (...) characters</error> - Enter correct password.
- <error>Please enter first name</error> - Enter first_name.
- <error>Please enter last name</error> - Enter last_name.
- <error>Please select country</error> - Enter country_id.
- <error>Please enter email</error> - Email address is not valid or not send. Enter correct email.
- <error>This email address is already in use</error> - Change email address.
- <error>User with mobile phone already exists</error> - Change mobile phone.
- <error>User with phone already exists</error> - Change phone.
- <error>User with fax already exists</error> - Change fax.
- <error>Default user is not present</error> - Default User's settings are not saved in database.
- <error>LCR was not found</error> - LCR id incorrect or does not exist
- <error>Location was not found</error> - Location id incorrect or does not exist
- <error>Password must be longer than 7 characters or short passwords in Devices should be allowed</error> - Use longer password or allow short passwords in devices
- <error>Password must contain at least one numeric value, capital and lowercase symbol - Use more secure password with at least one numeric value, capital and lowercase symbol
List of Country IDs
1 - Afghanistan
2 - Albania
3 - Algeria
4 - American Samoa
5 - Andorra
6 - Angola
7 - Anguilla
8 - Antarctica
9 - Antigua And Barbuda
10 - Argentina
11 - Armenia
12 - Aruba
13 - Australia
14 - Austria
15 - Azerbaijan
16 - Bahamas
17 - Bahrain
18 - Bangladesh
19 - Barbados
20 - Belarus
21 - Belgium
22 - Belize
23 - Benin
24 - Bermuda
25 - Bhutan
26 - Bolivia
27 - Bosnia And Herzegovina
28 - Botswana
30 - Brazil
32 - Brunei Darussalam
33 - Bulgaria
34 - Burkina Faso
35 - Burundi
36 - Cambodia
37 - Cameroon
38 - Canada
39 - Cape Verde
40 - Cayman Islands
41 - Central African Republic
42 - Chad
43 - Chile
44 - China
45 - Christmas Island
46 - Cocos (Keeling) Islands
47 - Colombia
48 - Comoros
49 - Congo
50 - Congo, The Democratic Republic Of The
51 - Cook Islands
52 - Costa Rica
53 - Ivory Cost
54 - Croatia
55 - Cuba
56 - Cyprus
57 - Czech Republic
58 - Denmark
59 - Djibouti
60 - Dominica
61 - Dominican Republic
62 - Ecuador
63 - Egypt
64 - El Salvador
65 - Equatorial Guinea
66 - Eritrea
67 - Estonia
68 - Ethiopia
69 - Falkland Islands (Malvinas)
70 - Faroe Islands
71 - Fiji
72 - Finland
73 - France
74 - French Guiana
75 - French Polynesia
77 - Gabon
78 - Gambia
79 - Georgia
80 - Germany
81 - Ghana
82 - Gibraltar
83 - Greece
84 - Greenland
85 - Grenada
86 - Guadeloupe
87 - Guam
88 - Guatemala
89 - Guinea
90 - Guinea-Bissau
91 - Guyana
92 - Haiti
94 - Vatican City
95 - Honduras
96 - Hong Kong
97 - Hungary
98 - Iceland
99 - India
100 - Indonesia
101 - Iran
102 - Iraq
103 - Ireland
104 - Israel
105 - Italy
106 - Jamaica
107 - Japan
108 - Jordan
109 - Kazakhstan
110 - Kenya
111 - Kiribati
112 - Korea, Democratic People's Republic Of
113 - Korea, Republic of
114 - Kuwait
115 - Kyrgyzstan
116 - Laos
117 - Latvia
118 - Lebanon
119 - Lesotho
120 - Liberia
121 - Libyan Arab Jamahiriya
122 - Liechtenstein
123 - Lithuania
124 - Luxembourg
125 - Macao
126 - Macedonia
127 - Madagascar
128 - Malawi
129 - Malaysia
130 - Maldives
131 - Mali
132 - Malta
133 - Marshall islands
134 - Martinique
135 - Mauritania
136 - Mauritius
137 - Mayotte
138 - Mexico
139 - Micronesia
140 - Moldova
141 - Monaco
142 - Mongolia
143 - Montserrat
144 - Morocco
145 - Mozambique
146 - Myanmar
147 - Namibia
148 - Nauru
149 - Nepal
150 - Netherlands
151 - Netherlands Antilles
152 - New Caledonia
153 - New Zealand
154 - Nicaragua
155 - Niger
156 - Nigeria
157 - Niue
158 - Norfolk Island
159 - Northern Mariana Islands
160 - Norway
161 - Oman
162 - Pakistan
163 - Palau
164 - Palestine
165 - Panama
166 - Papua New Guinea
167 - Paraguay
168 - Peru
169 - Philippines
171 - Poland
172 - Portugal
173 - Puerto Rico
174 - Qatar
175 - Reunion
176 - Romania
177 - Russian Federation
178 - Rwanda
179 - Saint Helena
180 - Saint Kitts And Nevis
181 - Saint Lucia
182 - Saint Pierre And Miquelon
183 - Saint Vincent And The Grenadines
184 - Samoa
185 - San Marino
186 - Sao Tome And Principe
187 - Saudi Arabia
188 - Senegal
189 - Seychelles
190 - Sierra Leone
191 - Singapore
192 - Slovakia
193 - Slovenia
194 - Solomon Islands
195 - Somalia
196 - South Africa
198 - Spain
199 - Sri Lanka
200 - Sudan
201 - Suriname
203 - Swaziland
204 - Sweden
205 - Switzerland
206 - Syrian Arab Republic
207 - Taiwan
208 - Tajikistan
209 - Tanzania
210 - Thailand
212 - Togo
213 - Tokelau
214 - Tonga
215 - Trinidad And Tobago
216 - Tunisia
217 - Turkey
218 - Turkmenistan
219 - Turks And Caicos Islands
220 - Tuvalu
221 - Uganda
222 - Ukraine
223 - United Arab Emirates
224 - United Kingdom
225 - United States
227 - Uruguay
228 - Uzbekistan
229 - Vanuatu
230 - Venezuela
231 - Vietnam
232 - Virgin Islands, British
233 - Virgin Islands, U.S.
234 - Wallis And Futuna
236 - Yemen
238 - Zambia
239 - Zimbabwe
240 - Ascension Island
241 - Diego Garcia
242 - Inmarsat
243 - East Timor
246 - Iridium
247 - Serbia and Montenegro
250 - Emsat
251 - Ellipso-3
252 - Globalstar
253 - Montenegro
254 - Kosovo
255 - South Sudan
256 - Thuraya
Possible Issues
The list above is default list of Country IDs in MOR. If you change something in database IDs can be changed too and you might get "Please select country" response from API. Also, if you add new direction from GUI, new ID will be assinged to it too. In both cases, you can find real Country/Direction ID from GUI in SETTINGS -> Billing -> Directions page Directions edit or Destinations list URL end: