aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-04-24 12:33:53 +0530
committerHarald Welte <laforge@gnumonks.org>2013-04-24 12:33:53 +0530
commit455b4785b9ae75eb134aa6ca625c309283446a12 (patch)
treefa1ceeb6bb8477d75d698c31feb7fa119a4ef989
parent5d4b3523c71f1f43ec04cf1115d68a57b296a586 (diff)
fix isup_party_nat00_internationalize() for empty number
Avoid running into an exception in case the calling party is an empty number "[]" (I guess call screening is applied).
-rw-r--r--src/mgw_nat.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mgw_nat.erl b/src/mgw_nat.erl
index 944543c..c67730a 100644
--- a/src/mgw_nat.erl
+++ b/src/mgw_nat.erl
@@ -341,7 +341,11 @@ isup_party_nat00_internationalize(PartyNum) ->
#party_number{phone_number = DigitsIn, nature_of_addr_ind = Nature} = PartyNum,
case Nature of
?ISUP_ADDR_NAT_NATIONAL ->
- {Pfx, Remain} = lists:split(2, DigitsIn),
+ if length(DigitsIn) < 2 ->
+ {Pfx, Remain} = {DigitsIn, []};
+ true ->
+ {Pfx, Remain} = lists:split(2, DigitsIn)
+ end,
if Pfx == [0, 0] ->
DigitsOut = Remain,
NatureOut = ?ISUP_ADDR_NAT_INTERNATIONAL,