首页 \ 问答 \ 如何从一个或几个服务器电话号码“多路复用”多个短信会话(How to “multiplex” multiple sms conversations from one or a few server phone numbers)

如何从一个或几个服务器电话号码“多路复用”多个短信会话(How to “multiplex” multiple sms conversations from one or a few server phone numbers)

所以这是用例:我们希望将聊天从我们的移动应用程序桥接到短信,这样他们就不必使用自定义信使应用程序。 服务器端,使用像Twilio这样的服务,您是否必须为每个会话/对话提供单独的电话号码? 如果是这样,那将是非常昂贵的。

在一个简单的用例中,一个服务器电话号码可以处理来自多个客户端和对话的所有传入短信。 它可以根据客户端发送者的电话号码,区分短信属于哪个对话,并将相应的回复过滤回每个对话中参与者的电话号码。 这将允许通过单个服务器电话号码管理多个对话。

但是,在增强的用例中,如果客户端同时在多个对话中,除非我们能够以某种方式在回复文本本身中嵌入信息,否则没有简单的方法来确定客户端的回复来自服务器的对话。 。

这只是一个限制,还是有办法允许这个增强的用例?

Twilio或SMS技术中有什么东西,或者我正在考虑的方式,这样可以让对话信息以傻瓜式的方式发回(例如,不要让用户手动输入对话ID)允许从同一客户端用户多路复用多个并发短信会话?


So here's the use case: we want to bridge chats from our mobile application to sms, so that they don't have to use a custom messenger app. Server-side, using a service like Twilio, would you have to provision separate phone numbers for every session/conversation? If so, that would be prohibitively expensive.

In a simple use case, one server phone number can handle all the incoming sms messages from multiple clients and conversations. It can, based on the client sender's phone number, discriminate what conversation the sms belongs to and send appropriate replies back filtered to the phone numbers of the participants in each conversation. This would allow multiple conversations to be managed by a single server phone number.

However, in an enhanced use case, if the client is in more than one conversation at the same time, there is no easy way to determine which conversation the client's reply was for from the server unless we can somehow embed info in the reply text itself.

Is that just a limitation or is there a way to allow for this enhanced use case?

Is there something in Twilio or in SMS technology, or in the way that I'm thinking about this that would allow that conversation info to be sent back in a fool-proof way (not making the user manually type the conversation id for instance) to allow multiplexing multiple concurrent sms conversations from the same client user?


原文:https://stackoverflow.com/questions/35612448
更新时间:2023-12-10 12:12

最满意答案

(长度+索引 - 1)MOD长度应该可以解决问题。

所以,当长度= 6时:

  • 如果index = 0 left_index =(6 + 0-1)MOD 6 = 5
  • 如果index = 4 left_index =(6 + 4 - 1)MOD 6 = 3 ......

(length + index - 1) MOD length should do the trick.

So, when length = 6:

  • If index = 0 left_index = (6 + 0 - 1) MOD 6 = 5
  • If index = 4 left_index = (6 + 4 - 1) MOD 6 = 3 ...

相关问答

更多
  • 虽然您可以使用eval()来执行此操作,但它依赖于安全的变量。 这更加安全得多 : function compute($num1, $operator, $num2) { switch($operator) { case "+": return $num1 + $num2; case "-": return $num1 - $num2; case "*": return $num1 * $num2; case "/": return $ ...
  • 在数组中,bash将[]之间的表达式视为算术。 从而 i=2 ; f[i++]=10 是完美的。 写f[((i++))]也是正确的,但在这种情况下, (())不被视为算术扩展运算符,而是作为嵌套括号。 注意((expr))计算expr,如果为真,则成功,而$((expr))作为其值展开。 所以f[$((i++))]也是正确的。 最后, f[$i++]不是你想要的,因为$i首先被扩展。 例如, i=j ; f[$i++] i=j ; f[$i++]将扩展为f[j++] 。 备注:一个奇怪的特性是bash在没 ...
  • 首先,176 * 1000不适合16位无符号短路。 因此,通过使用MISRA,您可以防止代码中的严重错误,因为算法是在signed int类型上计算的,并且它的结果隐式显示回无符号的short。 如果你得到预期的结果,那完全是巧合/运气。 请注意,还有另外两个未报告的MISRA违规咨询: 不允许使用类似函数的宏(规则19.7) 你应该使用一组预定义的整数typedef,如stint.h (规则6.3) 这两个都是非常好的规则,而不是你应该忽略的东西。 (另外它应该警告你使用没有'u'后缀的文字。) 修复是用 ...
  • 我不确定它有多大意义,但你可以在这里使用逗号运算符 : int i = (v.resize(42), 42); I'm not sure it makes much sense, but you could use the comma operator here: int i = (v.resize(42), 42);
  • 这个线条life = life2在def ud(life,life2,size,box):使life和live2都指向/指向相同的数据。 你需要深度复制 life2并让life指向绝对独立的数据。 深层复制 ,因为你的life2包含其他列表,如果你只通过做live = life2[:]进行浅拷贝 ,你仍然会遇到同样的问题 - 现场会有独特的refs列在它自己的内部,但数据的refs内部列表指向仍将被共享。 您可以使用import copy & copy.deepcopy(...)进行深层复制。 重命名 : ...
  • 我知道你的问题不是新鲜的,但你可以通过将数组声明为integer然后应用替换来完成你想要的东西: declare -ia arr=( 1 2 3 ) value=1 declare -ia 'arr_added=( "${arr[@]/%/+$value}" )' echo "arr_added: ${arr_added[*]}" value=42 declare -ia 'arr_added=( "${arr[@]/%/+$value}" )' echo "arr_added: ${arr_added ...
  • 划分可能比你想象的要简单: SELECT array_agg(value/2) FROM ... 但是, value/2究竟取决于数据类型。 如果value是integer ,则截断小数位。 要保留小数位,请使用value/2.0 。 小数位强制计算使用numeric完成。 COALESCE在阵列之外不会有任何区别。 要么没有行,那么你根本就没有结果('没有行'),或者如果有,你得到一个数组,可能有NULL元素。 但是数组本身的值永远不会为NULL 。 要用0替换单个NULL值: SELECT array ...
  • 通过使用preg_replace,您可以从值中删除“PHP”部分和逗号。 echo preg_replace('| PHP (\d+),(\d+)|', '$1$2', $array[5]) + preg_replace('| PHP (\d+),(\d+)|', '$1$2', $array[11]); 或者如果空格的数量是随机的'\ s'是任何空白字符 echo preg_replace('|\s+PHP\s+(\d+),(\d+)|', '$1$2', $array[5]) + preg ...
  • (长度+索引 - 1)MOD长度应该可以解决问题。 所以,当长度= 6时: 如果index = 0 left_index =(6 + 0-1)MOD 6 = 5 如果index = 4 left_index =(6 + 4 - 1)MOD 6 = 3 ...... (length + index - 1) MOD length should do the trick. So, when length = 6: If index = 0 left_index = (6 + 0 - 1) MOD 6 = 5 I ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。