In this tutorial I will share how to programmatically search and buy a virtual voice and SMS enabled phone number and point them to your own SIP and SMPP network/devices.
Search for a Phone Number in UK starting with 4471
curl --location --request POST 'https://apiv2.telecomsxchange.com/number/market' \
--form 'prefix=44741' \
--form 'country=' \
--form 'description=' \
--form 'seller=' \
--form 'voice=1' \
--form 'sms=1' \
--form 'fax=0' \
--form 'video=0' \
--form 'did_type=any' \
--form 'pager=5' \
--form 'off=0'
- API Response
{
"status": "success",
"dids": [
{
"i_did": "1002",
"country": "GB",
"msisdn": "447418340370",
"cost": "1.25",
"type": "mobile-lvn",
"features": [
"VOICE",
"SMS"
],
"monthly_fee": "2.5063",
"number": "447418340370",
"smpp_price": "0.0063",
"price_1": "0.0050",
"setup_fee": "0.0000",
"capacity": 50,
"voice": 1,
"sms": 1,
"video": 0,
"fax": 0,
"verification_required": 0,
"interval_1": 60,
"interval_n": 60,
"did_type": "mobile",
"vendor_name": "BT",
"is_nexmo": 0,
"country_code": "gb",
"country_name": "UNITED KINGDOM",
"description": "Mobile - Tismi",
"price_n": "0.0050"
}
Buy Phone Number and Point it to your SIP / SMPP Network Address
curl --location --request POST 'https://apiv2.telecomsxchange.com/number/purchase' \
--form 'i_did=1002' \
--form 'billing_i_account=[Your Billing Account ID]' \
--form 'contact=sip:447418340370@sip.domain.com:5060' \
--form 'smpp_contact=smpp:login:pass:447418340370@smpp.domain.com:PORT'
shell
{
"status": "success",
"message": "+447418340370 has been purchased and pointed to your network successfully"
}
That's it! You can now call or text +447418340370 from any phone and it'll be routed to your SIP/SMPP network.
Top comments (0)