DEV Community

Ameed Jamous for TelecomsXChange

Posted on

Buying Phone Numbers and Pointing them to your SIP/SMPP Network programmatically.

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'

Enter fullscreen mode Exit fullscreen mode
  • 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"
    }

Enter fullscreen mode Exit fullscreen mode

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'

Enter fullscreen mode Exit fullscreen mode


shell


{
  "status": "success",
  "message": "+447418340370 has been purchased and pointed to your network successfully"
}


Enter fullscreen mode Exit fullscreen mode

That's it! You can now call or text +447418340370 from any phone and it'll be routed to your SIP/SMPP network.

Latest comments (0)