1
無論出於何種原因textris gem正在刪除「+」。我怎樣才能阻止呢?Twilio :: REST :: RequestError:'收件人'號碼不是有效電話號碼
class UserTexter < Textris::Base
default :from => "+15616005697"
def welcome(user)
@user = user
text :to => '+' + @user.number # I've also tried hardcoding "+447576912465"
end
end
控制檯
UserTexter.welcome(u)
+447576912465 # See it has the plus in it
Rendered user_texter/welcome.text.erb (0.2ms)
=> #<Textris::Message:0x007fbbffc12ee8
@action=:welcome,
@content="Welcome to our system!",
@from_name="L.T.C.",
@from_phone="17864206788",
@texter=UserTexter,
@to=["447576912465"]> # but then it doesn't show here
[18] pry(main)> UserTexter.welcome(u).deliver
+[+447576912465]
Rendered user_texter/welcome.text.erb (0.6ms)
Twilio::REST::RequestError: The 'To' number 447576912465 is not a valid phone number. # hence why I get the error here
from /Users/galli01anthony/.rvm/gems/ruby-2.1.3/gems/twilio-ruby-4.11.1/lib/twilio-ruby/rest/base_client.rb:125:in `connect_and_send'
welcome_text.erb
<p>Test Text</p>
我該如何解決這個問題?問題的根源是什麼?我正在使用twilio gem連接到Twilio API。
大部分是'to_i'某處..可以在控制檯中檢查自己「+15616005697」.to_i' –
完成。這沒什麼特別的@ Md.FarhanMemon –
雅..我意識到,以後..我更新了代碼中的'to_i'的comment..check。 –