Skip to content

Commit

Permalink
Fix broker error when the configured twilio number is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
waj committed Jan 2, 2015
1 parent fa00555 commit e7ba115
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions broker/src/twilio/twilio_api.erl
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ update_voice_url(Channel, PhoneNumber) ->
incoming_phone_number_sid(Channel, PhoneNumber) ->
case incoming_phone_numbers(Channel, PhoneNumber) of
{ok, Data} ->
[{IncomingPhoneNumber}] = proplists:get_value(<<"incoming_phone_numbers">>, Data),
PhoneSid = proplists:get_value(<<"sid">>, IncomingPhoneNumber),
{ok, PhoneSid};
case proplists:get_value(<<"incoming_phone_numbers">>, Data) of
[{IncomingPhoneNumber}] ->
PhoneSid = proplists:get_value(<<"sid">>, IncomingPhoneNumber),
{ok, PhoneSid};
[] -> {error, twilio_number_not_found}
end;
Error -> Error
end.

0 comments on commit e7ba115

Please # to comment.