How To Strip +1 Out Of Incoming Number

Home » Asterisk Users » How To Strip +1 Out Of Incoming Number
Asterisk Users 4 Comments

Hello, our VoIP send us caller ID +1(area)(number) for instance
+16024224334 is there a way to strip +1 out of caller ID?

4 thoughts on - How To Strip +1 Out Of Incoming Number

  • ${CALLERID(num):1} should do what you’re after (or :2 if you need to strip the + as well)

    Kind regards,

    Chris

  • SSBwcmVmZXIgdXNpbmcgRklMVEVSKCkgc28gaWYgc29tZWhvdyBDYWxsZXJJRCBhcnJpdmVkIHdp dGggc29tZXRoaW5nIG5hc3R5IGl0IHdpbGwgYmUgZmlsdGVyZWQgb3V0Lg0KDQoNCkZyb206IGFz dGVyaXNrLXVzZXJzLWJvdW5jZXNAbGlzdHMuZGlnaXVtLmNvbSBbbWFpbHRvOmFzdGVyaXNrLXVz ZXJzLWJvdW5jZXNAbGlzdHMuZGlnaXVtLmNvbV0gT24gQmVoYWxmIE9mIEpvaG4gS2luaXN0b24N
    ClNlbnQ6IFRodXJzZGF5LCBPY3RvYmVyIDAyLCAyMDE0IDI6MDkgUE0NClRvOiBBc3RlcmlzayBV
    c2VycyBNYWlsaW5nIExpc3QgLSBOb24tQ29tbWVyY2lhbCBEaXNjdXNzaW9uDQpTdWJqZWN0OiBS
    ZTogW2FzdGVyaXNrLXVzZXJzXSBob3cgdG8gc3RyaXAgKzEgb3V0IG9mIGluY29taW5nIG51bWJl cg0KDQpUcnkgdGhlIEZpbHRlciBmdW5jdGlvbg0KDQpTZXQoY2lkPSR7RklMVEVSKDAxMjM0NTY3
    ODksJHtDQUxMRVJJRChOVU0pfSl9KQ0KDQpPbiBUaHUsIE9jdCAyLCAyMDE0IGF0IDEwOjUyIEFN
    LCBtb3R0eSBjcnV6IDxtb3R0eS5jcnV6QGdtYWlsLmNvbTxtYWlsdG86bW90dHkuY3J1ekBnbWFp bC5jb20+PiB3cm90ZToNCkhlbGxvLCBvdXIgVm9JUCBzZW5kIHVzIGNhbGxlciBJRCArMShhcmVh KShudW1iZXIpIG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ibGVtLCBwaXRjaCBtYW51cmUsIHByb2dyYW0gYSBjb21wdXRlciwgY29vayBhIHRhc3R5
    IG1lYWwsIGZpZ2h0IGVmZmljaWVudGx5LCBkaWUgZ2FsbGFudGx5LiBTcGVjaWFsaXphdGlvbiBp cyBmb3IgaW5zZWN0cy4NCi0tLUhlaW5sZWluDQo

  • I’ve always done it as 2 steps to handle carrier weirdness:

    ; trim leading +1 from DNIS
    same = n, execif($[“${DNIS:0:1}” = “+”]?set(DNIS=${DNIS:1}))
    same = n, execif($[“${DNIS:0:1}” = “1”]?set(DNIS=${DNIS:1}))