Sipper 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (326) hide show
  1. data/sipper/README.rb +26 -0
  2. data/sipper/b2bua_controller.rb +163 -0
  3. data/sipper/b2bua_session_mixin.rb +24 -0
  4. data/sipper/base_controller.rb +425 -0
  5. data/sipper/bin/common.rb +42 -0
  6. data/sipper/bin/generate.rb +70 -0
  7. data/sipper/bin/project.rb +44 -0
  8. data/sipper/bin/run.rb +85 -0
  9. data/sipper/bin/run_smoke.rb +8 -0
  10. data/sipper/config/log4r.xml +71 -0
  11. data/sipper/controller_class_loader.rb +29 -0
  12. data/sipper/controller_selector.rb +119 -0
  13. data/sipper/controllers/invite_controller.rb +30 -0
  14. data/sipper/controllers/order.yaml +3 -0
  15. data/sipper/custom_message.rb +4 -0
  16. data/sipper/detached_session.rb +11 -0
  17. data/sipper/docs/manual.txt +1621 -0
  18. data/sipper/generators/README +12 -0
  19. data/sipper/generators/gen_controller.rb +228 -0
  20. data/sipper/generators/gen_project.rb +45 -0
  21. data/sipper/generators/gen_test.rb +72 -0
  22. data/sipper/generators/project_template_dir/Rakefile +56 -0
  23. data/sipper/generators/project_template_dir/config/sipper.cfg +31 -0
  24. data/sipper/generators/project_template_dir/controllers/README.txt +2 -0
  25. data/sipper/generators/project_template_dir/dot_sipper.proj +2 -0
  26. data/sipper/generators/project_template_dir/logs/README.txt +2 -0
  27. data/sipper/generators/project_template_dir/tests/README.txt +2 -0
  28. data/sipper/lib/smc/statemap.rb +194 -0
  29. data/sipper/logs/dialog_info_store +0 -0
  30. data/sipper/logs/r.cmd +6 -0
  31. data/sipper/logs/r.sh +6 -0
  32. data/sipper/media/sipper_media_client.rb +268 -0
  33. data/sipper/media/sipper_media_event.rb +43 -0
  34. data/sipper/media/sipper_media_manager.rb +145 -0
  35. data/sipper/media/sipper_media_proxy.rb +60 -0
  36. data/sipper/media/sipper_offer_answer.rb +285 -0
  37. data/sipper/message.rb +512 -0
  38. data/sipper/modified_pattern_formatter.rb +119 -0
  39. data/sipper/proxy_controller.rb +143 -0
  40. data/sipper/registration.rb +52 -0
  41. data/sipper/request.rb +109 -0
  42. data/sipper/response.rb +123 -0
  43. data/sipper/ruby_ext/module.rb +27 -0
  44. data/sipper/ruby_ext/mutable_class.rb +17 -0
  45. data/sipper/ruby_ext/object.rb +38 -0
  46. data/sipper/ruby_ext/pqueue.rb +190 -0
  47. data/sipper/ruby_ext/snapshot.rb +201 -0
  48. data/sipper/ruby_ext/string.rb +18 -0
  49. data/sipper/ruby_ext/time.rb +9 -0
  50. data/sipper/run/run_sipper1.rb +28 -0
  51. data/sipper/run/run_sipper2.rb +56 -0
  52. data/sipper/sdp/sdp.rb +257 -0
  53. data/sipper/sdp/sdp_generator.rb +131 -0
  54. data/sipper/sdp/sdp_parser.rb +136 -0
  55. data/sipper/session.rb +1952 -0
  56. data/sipper/session_manager.rb +170 -0
  57. data/sipper/session_recorder.rb +190 -0
  58. data/sipper/session_state/DialogState.sm +54 -0
  59. data/sipper/session_state/DialogState_sm.rb +337 -0
  60. data/sipper/session_state/dialog_routes.rb +141 -0
  61. data/sipper/sip_headers/header.rb +632 -0
  62. data/sipper/sip_headers/sipuri.rb +352 -0
  63. data/sipper/sip_logger.rb +65 -0
  64. data/sipper/sip_message_router.rb +231 -0
  65. data/sipper/sip_test_driver_controller.rb +10 -0
  66. data/sipper/sipper.rb +329 -0
  67. data/sipper/sipper_assertions.rb +21 -0
  68. data/sipper/sipper_configurator.rb +376 -0
  69. data/sipper/sipper_http/sipper_http_request_dispatcher.rb +71 -0
  70. data/sipper/sipper_http/sipper_http_response.rb +25 -0
  71. data/sipper/stray_message_manager.rb +40 -0
  72. data/sipper/test_completion_signaling_helper.rb +77 -0
  73. data/sipper/transaction/Ict.sm +59 -0
  74. data/sipper/transaction/Ict_sm.rb +430 -0
  75. data/sipper/transaction/Ist.sm +74 -0
  76. data/sipper/transaction/Ist_sm.rb +460 -0
  77. data/sipper/transaction/Nict.sm +51 -0
  78. data/sipper/transaction/Nict_sm.rb +325 -0
  79. data/sipper/transaction/Nist.sm +59 -0
  80. data/sipper/transaction/Nist_sm.rb +356 -0
  81. data/sipper/transaction/invite_client_transaction.rb +274 -0
  82. data/sipper/transaction/invite_server_transaction.rb +319 -0
  83. data/sipper/transaction/non_invite_client_transaction.rb +230 -0
  84. data/sipper/transaction/non_invite_server_transaction.rb +263 -0
  85. data/sipper/transaction/state_machine_wrapper.rb +58 -0
  86. data/sipper/transaction/transaction.rb +212 -0
  87. data/sipper/transport/base_transport.rb +84 -0
  88. data/sipper/transport/rel_unrel.rb +19 -0
  89. data/sipper/transport/transport_and_route_resolver.rb +67 -0
  90. data/sipper/transport/udp_transport.rb +156 -0
  91. data/sipper/transport_manager.rb +33 -0
  92. data/sipper/udp_session.rb +17 -0
  93. data/sipper/util/command_element.rb +62 -0
  94. data/sipper/util/compact_converter.rb +50 -0
  95. data/sipper/util/counter.rb +26 -0
  96. data/sipper/util/digest/digest_authorizer.rb +204 -0
  97. data/sipper/util/expectation_parser.rb +164 -0
  98. data/sipper/util/locator.rb +31 -0
  99. data/sipper/util/message_fill.rb +58 -0
  100. data/sipper/util/persistence/ps_sipper_map.rb +63 -0
  101. data/sipper/util/persistence/sipper_map.rb +41 -0
  102. data/sipper/util/sipper_util.rb +305 -0
  103. data/sipper/util/timer/sip_timer_helper.rb +26 -0
  104. data/sipper/util/timer/timer_manager.rb +80 -0
  105. data/sipper/util/timer/timer_task.rb +56 -0
  106. data/sipper/util/validations.rb +44 -0
  107. data/sipper/version.rb +10 -0
  108. data/sipper_test/_test_media_uas.rb +79 -0
  109. data/sipper_test/base_test_case.rb +31 -0
  110. data/sipper_test/c_134.txt +7 -0
  111. data/sipper_test/driven_sip_test_case.rb +96 -0
  112. data/sipper_test/gold.txt +10 -0
  113. data/sipper_test/gold_res.txt +8 -0
  114. data/sipper_test/gold_sub.txt +9 -0
  115. data/sipper_test/hello_sipper.au +0 -0
  116. data/sipper_test/in_sipper.au +0 -0
  117. data/sipper_test/nonrr_proxy.rb +17 -0
  118. data/sipper_test/order_tests.yaml +4 -0
  119. data/sipper_test/rake_res.txt +399 -0
  120. data/sipper_test/rr_proxy.rb +17 -0
  121. data/sipper_test/run_test.cmd +94 -0
  122. data/sipper_test/sip_test_case.rb +104 -0
  123. data/sipper_test/test2xx_retransmission.rb +80 -0
  124. data/sipper_test/test2xx_retransmission_with_limit.rb +81 -0
  125. data/sipper_test/test2xx_retransmission_with_nist.rb +91 -0
  126. data/sipper_test/test2xx_retransmission_with_txns.rb +94 -0
  127. data/sipper_test/test_address_header.rb +66 -0
  128. data/sipper_test/test_b2bua1.rb +130 -0
  129. data/sipper_test/test_b2bua2.rb +120 -0
  130. data/sipper_test/test_b2bua3.rb +160 -0
  131. data/sipper_test/test_b2bua4.rb +130 -0
  132. data/sipper_test/test_base_controller.rb +110 -0
  133. data/sipper_test/test_base_transport.rb +37 -0
  134. data/sipper_test/test_cancel.rb +21 -0
  135. data/sipper_test/test_cancel_after2xx.rb +81 -0
  136. data/sipper_test/test_cancel_retransmission.rb +105 -0
  137. data/sipper_test/test_cancel_with481.rb +83 -0
  138. data/sipper_test/test_cancel_with487.rb +70 -0
  139. data/sipper_test/test_cancel_with_ist_without_nist.rb +99 -0
  140. data/sipper_test/test_cancel_with_nist.rb +84 -0
  141. data/sipper_test/test_cancel_without487.rb +77 -0
  142. data/sipper_test/test_command_element.rb +38 -0
  143. data/sipper_test/test_compact_converter.rb +33 -0
  144. data/sipper_test/test_controller_class_loader.rb +37 -0
  145. data/sipper_test/test_controller_selector.rb +53 -0
  146. data/sipper_test/test_controller_using_compact_headers.rb +74 -0
  147. data/sipper_test/test_controller_using_header_order.rb +85 -0
  148. data/sipper_test/test_controller_using_ict.rb +64 -0
  149. data/sipper_test/test_controller_using_ict_with_non_success.rb +72 -0
  150. data/sipper_test/test_controller_using_ict_with_tcbh.rb +24 -0
  151. data/sipper_test/test_controller_using_ict_with_tcbh_no_action.rb +24 -0
  152. data/sipper_test/test_controller_using_ist.rb +70 -0
  153. data/sipper_test/test_controller_using_ist_with_tcbh.rb +24 -0
  154. data/sipper_test/test_controller_using_nict.rb +115 -0
  155. data/sipper_test/test_controller_using_nict_with_tcbh.rb +24 -0
  156. data/sipper_test/test_controller_using_nist.rb +63 -0
  157. data/sipper_test/test_controller_using_pre_existing_rs0.rb +73 -0
  158. data/sipper_test/test_controller_using_pre_existing_rs1.rb +75 -0
  159. data/sipper_test/test_controller_using_pre_existing_rs2.rb +71 -0
  160. data/sipper_test/test_controller_using_route_set.rb +86 -0
  161. data/sipper_test/test_controller_with_sdp.rb +80 -0
  162. data/sipper_test/test_controllers/cancel/order.yaml +2 -0
  163. data/sipper_test/test_controllers/cancel/uac_cancel_controller.rb +35 -0
  164. data/sipper_test/test_controllers/cancel/uas_cancel_controller.rb +25 -0
  165. data/sipper_test/test_controllers/class_loading/ordered/first_ordered_controller.rb +5 -0
  166. data/sipper_test/test_controllers/class_loading/ordered/order.yaml +3 -0
  167. data/sipper_test/test_controllers/class_loading/ordered/recond_ordered_controller.rb +6 -0
  168. data/sipper_test/test_controllers/class_loading/ordered/second_ordered_controller.rb +6 -0
  169. data/sipper_test/test_controllers/class_loading/unordered/first_unordered_controller.rb +7 -0
  170. data/sipper_test/test_controllers/class_loading/unordered/second_unordered_controller.rb +6 -0
  171. data/sipper_test/test_controllers/ctrl_trhandler/lib/transport_filters/my_transport_handler.rb +22 -0
  172. data/sipper_test/test_controllers/ctrl_trhandler/uac_tr_handler_controller.rb +27 -0
  173. data/sipper_test/test_controllers/ctrl_trhandler/uas_tr_handler_controller.rb +21 -0
  174. data/sipper_test/test_controllers/ete/order.yaml +1 -0
  175. data/sipper_test/test_controllers/ete/uac_controller.rb +39 -0
  176. data/sipper_test/test_controllers/ete/uas_controller.rb +34 -0
  177. data/sipper_test/test_controllers/extensions/extension_uac_controller.rb +24 -0
  178. data/sipper_test/test_controllers/extensions/extension_uas_controller.rb +35 -0
  179. data/sipper_test/test_controllers/extensions/lib/sipper_extensions/my_from_extension.rb +16 -0
  180. data/sipper_test/test_controllers/ict_tcbh/lib/transaction_handlers/app_ict_handler.rb +23 -0
  181. data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_controller.rb +27 -0
  182. data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_no_action_controller.rb +28 -0
  183. data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_controller.rb +29 -0
  184. data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_no_action_controller.rb +31 -0
  185. data/sipper_test/test_controllers/ist_tcbh/lib/app_ist_handler.rb +13 -0
  186. data/sipper_test/test_controllers/ist_tcbh/uac_ist_tcbh_controller.rb +22 -0
  187. data/sipper_test/test_controllers/ist_tcbh/uas_ist_tcbh_controller.rb +31 -0
  188. data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/in_order.yaml +2 -0
  189. data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler1.rb +21 -0
  190. data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler2.rb +21 -0
  191. data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/out_order.yaml +2 -0
  192. data/sipper_test/test_controllers/multi_trhandlers/uac_multi_tr_handler_controller.rb +27 -0
  193. data/sipper_test/test_controllers/multi_trhandlers/uas_multi_tr_handler_controller.rb +29 -0
  194. data/sipper_test/test_controllers/multiple/lib/blank_test.rb +2 -0
  195. data/sipper_test/test_controllers/multiple/uac_info_controller.rb +21 -0
  196. data/sipper_test/test_controllers/multiple/uac_msg_controller.rb +20 -0
  197. data/sipper_test/test_controllers/multiple/uas_info_controller.rb +15 -0
  198. data/sipper_test/test_controllers/multiple/uas_msg_controller.rb +14 -0
  199. data/sipper_test/test_controllers/nict_tcbh/lib/transaction_handlers/app_nict_handler.rb +13 -0
  200. data/sipper_test/test_controllers/nict_tcbh/uac_nict_tcbh_controller.rb +26 -0
  201. data/sipper_test/test_controllers/nict_tcbh/uas_nict_tcbh_controller.rb +20 -0
  202. data/sipper_test/test_controllers/state_machine_based/lib/CreditControl.sm +43 -0
  203. data/sipper_test/test_controllers/state_machine_based/lib/CreditControl_sm.rb +194 -0
  204. data/sipper_test/test_controllers/state_machine_based/order.yaml +1 -0
  205. data/sipper_test/test_controllers/state_machine_based/uac_message_controller.rb +34 -0
  206. data/sipper_test/test_controllers/state_machine_based/uas_message_controller.rb +44 -0
  207. data/sipper_test/test_controllers/stray_message/lib/sipper_extensions/my_stray_handler.rb +9 -0
  208. data/sipper_test/test_controllers/stray_message/stray_uac_controller.rb +24 -0
  209. data/sipper_test/test_controllers/stray_message/stray_uas_controller.rb +31 -0
  210. data/sipper_test/test_controllers/string/order.yaml +1 -0
  211. data/sipper_test/test_controllers/string/uac_controller.rb +29 -0
  212. data/sipper_test/test_controllers/string/uas_controller.rb +22 -0
  213. data/sipper_test/test_controllers/test_controller.rb +24 -0
  214. data/sipper_test/test_detached_session1.rb +78 -0
  215. data/sipper_test/test_dialog_routes.rb +139 -0
  216. data/sipper_test/test_digest_challenge1.rb +89 -0
  217. data/sipper_test/test_digest_challenge2.rb +90 -0
  218. data/sipper_test/test_dynamic_parse.rb +249 -0
  219. data/sipper_test/test_empty_sdp.rb +89 -0
  220. data/sipper_test/test_ete.rb +37 -0
  221. data/sipper_test/test_expectation_parser.rb +76 -0
  222. data/sipper_test/test_extensions.rb +28 -0
  223. data/sipper_test/test_freeze.rb +81 -0
  224. data/sipper_test/test_generated.rb +90 -0
  225. data/sipper_test/test_header_parameters.rb +75 -0
  226. data/sipper_test/test_header_parse.rb +141 -0
  227. data/sipper_test/test_http_client1.rb +84 -0
  228. data/sipper_test/test_http_client2.rb +90 -0
  229. data/sipper_test/test_ict_with_timeout.rb +62 -0
  230. data/sipper_test/test_in_dialog_request.rb +61 -0
  231. data/sipper_test/test_inline_controller.rb +67 -0
  232. data/sipper_test/test_invite_client_transaction.rb +272 -0
  233. data/sipper_test/test_invite_replace.rb +147 -0
  234. data/sipper_test/test_invite_retransmission.rb +90 -0
  235. data/sipper_test/test_invite_server_transaction.rb +208 -0
  236. data/sipper_test/test_lower_cseq.rb +79 -0
  237. data/sipper_test/test_media.rb +52 -0
  238. data/sipper_test/test_message.rb +392 -0
  239. data/sipper_test/test_method_specific_response_handling.rb +81 -0
  240. data/sipper_test/test_multi_homed1.rb +127 -0
  241. data/sipper_test/test_multi_homed2.rb +109 -0
  242. data/sipper_test/test_multi_homed_duplicate.rb +87 -0
  243. data/sipper_test/test_multi_homed_with_detached.rb +88 -0
  244. data/sipper_test/test_multiple.rb +49 -0
  245. data/sipper_test/test_multiple_contacts.rb +89 -0
  246. data/sipper_test/test_non2xx_retransmission_with_ist.rb +87 -0
  247. data/sipper_test/test_non_invite_client_transaction.rb +210 -0
  248. data/sipper_test/test_non_invite_retransmission.rb +91 -0
  249. data/sipper_test/test_non_invite_server_transaction.rb +202 -0
  250. data/sipper_test/test_offer_answer_prack.rb +103 -0
  251. data/sipper_test/test_pickup.rb +258 -0
  252. data/sipper_test/test_prack.rb +105 -0
  253. data/sipper_test/test_prack_store_and_dispatch.rb +101 -0
  254. data/sipper_test/test_prack_timer.rb +105 -0
  255. data/sipper_test/test_ps_sipper_map.rb +56 -0
  256. data/sipper_test/test_re_invite_uas_ongoing_ict.rb +81 -0
  257. data/sipper_test/test_re_invite_uas_ongoing_ist.rb +84 -0
  258. data/sipper_test/test_re_invite_with_ongoing_ict.rb +101 -0
  259. data/sipper_test/test_re_invite_with_ongoing_ist.rb +89 -0
  260. data/sipper_test/test_recorder_swap.rb +157 -0
  261. data/sipper_test/test_refer.rb +121 -0
  262. data/sipper_test/test_registeration_clearing.rb +97 -0
  263. data/sipper_test/test_registrar.rb +109 -0
  264. data/sipper_test/test_registration_controller.rb +73 -0
  265. data/sipper_test/test_registration_timeout.rb +90 -0
  266. data/sipper_test/test_remote_controller.rb +39 -0
  267. data/sipper_test/test_remote_target_update_on2xx.rb +140 -0
  268. data/sipper_test/test_request.rb +106 -0
  269. data/sipper_test/test_response.rb +40 -0
  270. data/sipper_test/test_response_without_to_tag.rb +92 -0
  271. data/sipper_test/test_rport.rb +88 -0
  272. data/sipper_test/test_sdp.rb +91 -0
  273. data/sipper_test/test_sdp_parser.rb +145 -0
  274. data/sipper_test/test_session.rb +276 -0
  275. data/sipper_test/test_session_callback_handler.rb +68 -0
  276. data/sipper_test/test_session_lifetime.rb +66 -0
  277. data/sipper_test/test_session_manager.rb +141 -0
  278. data/sipper_test/test_session_recorder.rb +145 -0
  279. data/sipper_test/test_session_state_user_defined.rb +84 -0
  280. data/sipper_test/test_session_states.rb +91 -0
  281. data/sipper_test/test_simple_dialog_state.rb +86 -0
  282. data/sipper_test/test_simple_re_invite.rb +86 -0
  283. data/sipper_test/test_sip_uri.rb +234 -0
  284. data/sipper_test/test_sipper_util.rb +45 -0
  285. data/sipper_test/test_smc_controller.rb +17 -0
  286. data/sipper_test/test_smoke.rb +80 -0
  287. data/sipper_test/test_stray.rb +28 -0
  288. data/sipper_test/test_stray_inline.rb +89 -0
  289. data/sipper_test/test_stray_res_acked.rb +103 -0
  290. data/sipper_test/test_stray_respond.rb +104 -0
  291. data/sipper_test/test_stray_retry.rb +92 -0
  292. data/sipper_test/test_stray_retry_failure.rb +93 -0
  293. data/sipper_test/test_stray_retry_initial.rb +100 -0
  294. data/sipper_test/test_strict_router_with_angled.rb +84 -0
  295. data/sipper_test/test_string_record.rb +31 -0
  296. data/sipper_test/test_subscribe_notify.rb +141 -0
  297. data/sipper_test/test_subscribe_notify_client_timeout.rb +158 -0
  298. data/sipper_test/test_subscribe_notify_dialog.rb +146 -0
  299. data/sipper_test/test_subscribe_notify_expires.rb +155 -0
  300. data/sipper_test/test_subscribe_notify_multiple_subscription.rb +157 -0
  301. data/sipper_test/test_subscribe_notify_server_timeout.rb +144 -0
  302. data/sipper_test/test_subsequent_unsent.rb +88 -0
  303. data/sipper_test/test_target_refresh_proxy_detached.rb +128 -0
  304. data/sipper_test/test_target_refresh_proxy_udp.rb +130 -0
  305. data/sipper_test/test_target_refresh_rr_proxy_udp.rb +133 -0
  306. data/sipper_test/test_target_refresh_with_new_port.rb +158 -0
  307. data/sipper_test/test_target_refresh_with_proxy1.rb +113 -0
  308. data/sipper_test/test_target_refresh_with_rr_update_proxy.rb +145 -0
  309. data/sipper_test/test_target_refresh_with_update_proxy.rb +144 -0
  310. data/sipper_test/test_target_refresh_with_update_proxy2.rb +139 -0
  311. data/sipper_test/test_timer_manager.rb +71 -0
  312. data/sipper_test/test_timer_task.rb +60 -0
  313. data/sipper_test/test_transport_handler.rb +19 -0
  314. data/sipper_test/test_transport_multi_handler.rb +18 -0
  315. data/sipper_test/test_udp_transport.rb +119 -0
  316. data/sipper_test/test_unparsed.rb +70 -0
  317. data/sipper_test/test_validations.rb +69 -0
  318. data/sipper_test/test_with_rr_proxy.rb +111 -0
  319. data/sipper_test/testmediacontroller.rb +71 -0
  320. data/sipper_test/tracing.rb +23 -0
  321. data/sipper_test/transaction_test_helper.rb +176 -0
  322. data/sipper_test/transport_filters.rb +26 -0
  323. data/sipper_test/ts_sipper.rb +91 -0
  324. data/sipper_test/ts_smoke.rb +3 -0
  325. data/sipper_test/tt.cmd +20 -0
  326. metadata +455 -0
@@ -0,0 +1,52 @@
1
+ require 'driven_sip_test_case'
2
+
3
+ class TestMedia < DrivenSipTestCase
4
+
5
+ def setup
6
+ @sm = SipperConfigurator[:SipperMedia]
7
+ SipperConfigurator[:SipperMedia] = true
8
+ super
9
+ str = <<-EOF
10
+
11
+ require 'sip_test_driver_controller'
12
+ require 'media/sipper_media_client'
13
+ module SipInline
14
+ class UacMediaController < SIP::SipTestDriverController
15
+
16
+ transaction_usage :use_transactions=>true
17
+
18
+ def start
19
+ u = create_udp_session(SipperConfigurator[:LocalSipperIP], SipperConfigurator[:LocalTestPort])
20
+ m = u.create_sipper_media_client
21
+ if m.start
22
+ m.create_media
23
+ sleep 1
24
+ m.send_info("127.0.0.1", 54593)
25
+ sleep 1
26
+ m.add_codecs
27
+ sleep 1
28
+ puts "sleeping..."
29
+ m.set_status
30
+ m.clear_codecs
31
+ end
32
+ end
33
+ end
34
+ end
35
+ EOF
36
+ define_controller_from(str)
37
+ set_controller("SipInline::UacMediaController")
38
+ end
39
+
40
+ def teardown
41
+ SipperConfigurator[:SipperMedia] = @sm
42
+ super
43
+ end
44
+
45
+ def test_media_controllers
46
+ start_controller
47
+ end
48
+
49
+
50
+ end
51
+
52
+
@@ -0,0 +1,392 @@
1
+ require 'base_test_case'
2
+
3
+ class TestMessage < BaseTestCase
4
+
5
+ def setup
6
+ @orig_methods = Message.instance_methods
7
+ end
8
+
9
+ def test_init
10
+ m = Message.new(:a=>"first", :b=>"second")
11
+ assert_equal("first", m.a.to_s)
12
+ assert_equal("second", m.b.to_s)
13
+ assert_nil(m.rcvd_from_info)
14
+ end
15
+
16
+ def test_parse_request
17
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
18
+ Via: SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0
19
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
20
+ To: sut <sip:service@127.0.0.1:5060>
21
+ Call-ID: 1-2352@127.0.0.1
22
+ CSeq: 1 INVITE
23
+ Contact: sip:sippp@127.0.0.1:6061
24
+ Max-Forwards: 70
25
+ Subject: Performance Test
26
+ Content-Type: application/sdp
27
+ Content-Length: 129
28
+
29
+ v=0
30
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
31
+ s=-
32
+ c=IN IP4 127.0.0.1
33
+ t=0 0
34
+ m=audio 6000 RTP/AVP 0
35
+ a=rtpmap:0 PCMU/8000}
36
+
37
+ body_str = %q{v=0
38
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
39
+ s=-
40
+ c=IN IP4 127.0.0.1
41
+ t=0 0
42
+ m=audio 6000 RTP/AVP 0
43
+ a=rtpmap:0 PCMU/8000
44
+ }
45
+
46
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
47
+ r = Message.parse msg
48
+ assert_instance_of(Request, r)
49
+ assert_equal("SIP/2.0/UDP 127.0.0.1:6061;received=127.0.0.1;branch=z9hG4bK-2352-1-0", r.via.to_s)
50
+ assert_equal(129, r.content_len) # no \r in text
51
+ assert_equal(["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"], r.rcvd_from_info )
52
+ assert_equal("v=0", r.contents[0])
53
+ assert_equal("a=rtpmap:0 PCMU/8000", r.contents[6])
54
+ assert(r.is_request?)
55
+ assert_equal(body_str, r.body.gsub("\r", "")) # as no \r in text
56
+ end
57
+
58
+
59
+ def test_parse_request_with_rport
60
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
61
+ Via: SIP/2.0/UDP 127.0.0.1:6061;rport;branch=z9hG4bK-2352-1-0
62
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
63
+ To: sut <sip:service@127.0.0.1:5060>
64
+ Call-ID: 1-2352@127.0.0.1
65
+ CSeq: 1 INVITE
66
+ Contact: sip:sippp@127.0.0.1:6061
67
+ Max-Forwards: 70
68
+ Subject: Performance Test
69
+ Content-Type: application/sdp
70
+ Content-Length: 129
71
+
72
+ v=0
73
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
74
+ s=-
75
+ c=IN IP4 127.0.0.1
76
+ t=0 0
77
+ m=audio 6000 RTP/AVP 0
78
+ a=rtpmap:0 PCMU/8000}
79
+
80
+ body_str = %q{v=0
81
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
82
+ s=-
83
+ c=IN IP4 127.0.0.1
84
+ t=0 0
85
+ m=audio 6000 RTP/AVP 0
86
+ a=rtpmap:0 PCMU/8000
87
+ }
88
+
89
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
90
+ r = Message.parse msg
91
+ assert_instance_of(Request, r)
92
+ assert_equal("SIP/2.0/UDP 127.0.0.1:6061;rport=33302;received=127.0.0.1;branch=z9hG4bK-2352-1-0", r.via.to_s)
93
+ assert_equal(["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"], r.rcvd_from_info )
94
+ end
95
+
96
+ def test_parse_request_with_compact
97
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
98
+ v: SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0
99
+ f: sipp <sip:sipp@127.0.0.1:6061>;tag=1
100
+ t: sut <sip:service@127.0.0.1:5060>
101
+ i: 1-2352@127.0.0.1
102
+ CSeq: 1 INVITE
103
+ m: sip:nasir@127.0.0.1:6061
104
+ Max-Forwards: 70
105
+ s: Functional Test
106
+ c: application/sdp
107
+ l: 129
108
+
109
+ v=0
110
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
111
+ s=-
112
+ c=IN IP4 127.0.0.1
113
+ t=0 0
114
+ m=audio 6000 RTP/AVP 0
115
+ a=rtpmap:0 PCMU/8000}
116
+
117
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
118
+ r = Message.parse msg
119
+ assert_instance_of(Request, r)
120
+ assert_equal("SIP/2.0/UDP 127.0.0.1:6061;received=127.0.0.1;branch=z9hG4bK-2352-1-0", r.via.to_s)
121
+ assert_equal("sipp <sip:sipp@127.0.0.1:6061>;tag=1", r.from.to_s)
122
+ assert_equal("sut <sip:service@127.0.0.1:5060>", r.to.to_s)
123
+ assert_equal("1-2352@127.0.0.1", r.call_id.to_s)
124
+ assert_equal("<sip:nasir@127.0.0.1:6061>", r.contact.to_s)
125
+ assert_equal("Functional Test", r.subject.to_s)
126
+ assert_equal("application/sdp", r.content_type.to_s)
127
+ assert_equal("129", r.content_length.to_s)
128
+ assert(r.is_request?)
129
+ end
130
+
131
+ def test_partial_content
132
+ orig = SipperConfigurator[:ProtocolCompliance]
133
+ SipperConfigurator[:ProtocolCompliance] = 'strict'
134
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
135
+ Via: SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0
136
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
137
+ To: sut <sip:service@127.0.0.1:5060>
138
+ Call-ID: 1-2352@127.0.0.1
139
+ CSeq: 1 INVITE
140
+ Contact: sip:sippp@127.0.0.1:6061
141
+ Max-Forwards: 70
142
+ Subject: Performance Test
143
+ Content-Type: application/sdp
144
+ Content-Length: 10
145
+
146
+ v=0
147
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
148
+ s=-
149
+ c=IN IP4 127.0.0.1
150
+ t=0 0
151
+ m=audio 6000 RTP/AVP 0
152
+ a=rtpmap:0 PCMU/8000}
153
+
154
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
155
+ r = Message.parse msg
156
+ assert_instance_of(Request, r)
157
+ assert_equal("v=0", r.contents[0])
158
+ assert_equal("o=user1", r.contents[1])
159
+ SipperConfigurator[:ProtocolCompliance] = orig
160
+ end
161
+
162
+
163
+ # Content-Length header is 1000
164
+ def test_truncated_content
165
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
166
+ Via: SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0
167
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
168
+ To: sut <sip:service@127.0.0.1:5060>
169
+ Call-ID: 1-2352@127.0.0.1
170
+ CSeq: 1 INVITE
171
+ Contact: sip:sippp@127.0.0.1:6061
172
+ Max-Forwards: 70
173
+ Subject: Performance Test
174
+ Content-Type: application/sdp
175
+ Content-Length: 1000
176
+
177
+ v=0
178
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
179
+ s=-
180
+ c=IN IP4 127.0.0.1
181
+ t=0 0
182
+ m=audio 6000 RTP/AVP 0
183
+ a=rtpmap:0 PCMU/8000}
184
+
185
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
186
+ r = Message.parse msg
187
+ assert_equal(129, r.content_len) # assuming a \r in content_len we add
188
+ assert_equal(1000, r.content_length.to_s.to_i)
189
+ end
190
+
191
+
192
+ def test_via_received
193
+ str = %q{INVITE sip:service@127.0.0.1:5060 SIP/2.0
194
+ Via: SIP/2.0/UDP ash@home.com;branch=z9hG4bK-2352-1-0
195
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
196
+ To: sut <sip:service@127.0.0.1:5060>
197
+ Call-ID: 1-2352@127.0.0.1
198
+ CSeq: 1 INVITE
199
+ Contact: sip:sippp@127.0.0.1:6061
200
+ Max-Forwards: 70
201
+ Subject: Performance Test
202
+ Content-Type: application/sdp
203
+ Content-Length: 129
204
+
205
+ v=0
206
+ o=user1 53655765 2353687637 IN IP4 127.0.0.1
207
+ s=-
208
+ c=IN IP4 127.0.0.1
209
+ t=0 0
210
+ m=audio 6000 RTP/AVP 0
211
+ a=rtpmap:0 PCMU/8000}
212
+ msg = [str, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
213
+ r = Message.parse msg
214
+ assert_equal("SIP/2.0/UDP ash@home.com;received=127.0.0.1;branch=z9hG4bK-2352-1-0", r.via.to_s)
215
+ end
216
+
217
+ def test_parse_response
218
+ str = %q{SIP/2.0 200 OK
219
+ Contact: <sip:127.0.0.1:5060;transport=UDP>
220
+ Call-Id: 1-2352@127.0.0.1
221
+ Via: SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0
222
+ From: sipp <sip:sipp@127.0.0.1:6061>;tag=1
223
+ To: sut <sip:service@127.0.0.1:5060>;tag=1
224
+ Cseq: 1 INVITE}
225
+ msg = [str, ["AF_INET", 33303, "localhost.localdomain", "127.0.0.1"]]
226
+ r = Message.parse msg
227
+ assert_instance_of(Response, r)
228
+ assert_equal("SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0", r.via.to_s)
229
+ assert_equal(["AF_INET", 33303, "localhost.localdomain", "127.0.0.1"], r.rcvd_from_info )
230
+ assert(r.is_response?)
231
+ end
232
+
233
+ def test_parse_junk
234
+ str = "junk"
235
+ msg = [str, ["AF_INET", 33303, "localhost.localdomain", "127.0.0.1"]]
236
+ assert_raise(ArgumentError) {r = Message.parse msg}
237
+ end
238
+
239
+ def test_each
240
+ _make_message
241
+ assert(@m.respond_to?(:each))
242
+ n = 0
243
+ @m.each {|k,v| n+=1}
244
+ assert_equal(8, n) # 3 addnl system headers
245
+ end
246
+
247
+ def test_copy_from
248
+ _make_message
249
+ m = Message.new
250
+ m.copy_from(@m, :via, :from)
251
+ assert_equal(@m.via, m.via)
252
+ assert_equal(@m.from, m.from)
253
+ assert_nil(m.to)
254
+ assert_nothing_raised{m.copy_from(@m, :blah)} #non existent header
255
+ assert(!m.respond_to?(:blah))
256
+ end
257
+
258
+ def test_copy_from_2
259
+ _make_message
260
+ m = Message.new
261
+ m.copy_from(@m, :_sipper_all)
262
+ @m.each_header {|h| assert_equal(@m[h], m[h])}
263
+ end
264
+
265
+
266
+ def test_dynamic
267
+ m = Message.new
268
+ m.via = str = "SIP/2.0/UDP pc21@biloxi.com;branch=z9hG4bK-2352-1-0"
269
+ assert_equal(str, m.via.to_s)
270
+ assert_equal(str, m.vias[0].to_s)
271
+ str2 = "SIP/2.0/UDP pc44@biloxi.com;branch=z9hG4bK-2353-1-0"
272
+ m.add_via(str2)
273
+ assert_equal(str, m.vias[0].to_s)
274
+ assert_equal(str2, m.vias[1].to_s)
275
+ assert_equal(str, m.via.to_s)
276
+ str3 = m.pop_via.to_s
277
+ assert_equal(str, str3)
278
+ assert_equal(str2, m.via.to_s)
279
+ m.push_via(str3)
280
+ assert_equal(str, m.via.to_s)
281
+ assert_equal(str2, m.vias[1].to_s)
282
+ m.via = str4 = "SIP/2.0/UDP pc55@biloxi.com;branch=z9hG4bK-2353-1-0"
283
+ assert_equal(str4, m.via.to_s)
284
+ assert(1, m.vias.length)
285
+ m.via = [str, str2]
286
+ assert_equal(str, m.via.to_s)
287
+ assert_equal(str, m.vias[0].to_s)
288
+ assert_equal(str2, m.vias[1].to_s)
289
+ end
290
+
291
+ def test_popnilout
292
+ m = Message.new
293
+ m.via = "SIP/2.0/UDP pc21@biloxi.com;branch=z9hG4bK-2352-1-0"
294
+ assert_not_nil(m.via)
295
+ m.pop_via()
296
+ assert_nil(m.via)
297
+ end
298
+
299
+ def test_blank_value
300
+ m = Message.new
301
+ m.via = ''
302
+ assert_not_nil(m.via)
303
+ end
304
+
305
+ def test_multivalued
306
+ msg = Message.new
307
+ msg.route = "sip:r@oute1, sip:r@oute2, sip:r@oute3"
308
+ _check_mv_route( msg )
309
+
310
+ msg = Message.new
311
+ msg.route = ["sip:r@oute1", "sip:r@oute2", "sip:r@oute3"]
312
+ _check_mv_route( msg )
313
+
314
+ msg = Message.new
315
+ msg.add_route("sip:r@oute1").add_route("sip:r@oute2").add_route("sip:r@oute3")
316
+ _check_mv_route( msg )
317
+
318
+ msg = Message.new
319
+ msg.push_route("sip:r@oute3").push_route("sip:r@oute2").push_route("sip:r@oute1")
320
+ _check_mv_route( msg )
321
+ end
322
+
323
+
324
+ def test_array_access
325
+ _make_message
326
+ assert_equal("sipp <sip:sipp@127.0.0.1:6061>;tag=1", @m[:from][0].to_s)
327
+ assert(!@m.respond_to?(:blah))
328
+ @m[:blah] = "blah"
329
+ assert(@m.respond_to?(:blah))
330
+ assert_equal(["blah"], @m[:blah].map{|x| x.to_s})
331
+ assert_equal("blah", @m.blah.to_s)
332
+ @m[:blahblah] = arr = ["blah", "blah"]
333
+ assert_equal(arr, @m[:blahblah].map {|x| x.to_s})
334
+ assert_equal("blah", @m.blahblah.to_s)
335
+ end
336
+
337
+ def test_content
338
+ _make_message
339
+ @m.content = "v=0\r\ns=-\r\nt=0 0" # translates to ["v=0", "s=-", "t=0 0"] with usual \r\n
340
+ assert_equal(17, @m.content_len)
341
+ assert_equal("v=0", @m.content)
342
+ assert_equal(["v=0", "s=-", "t=0 0"], @m.contents)
343
+ end
344
+
345
+ def test_tags
346
+ _make_message
347
+ assert_equal("1", @m.from_tag)
348
+ assert_equal("azxs21", @m.to_tag)
349
+ end
350
+
351
+ def test_header_order
352
+ _make_message
353
+ order = [:to, :from, :via, :call_id, :max_forwards, :non_existent1, :p_asserted_identity, :cseq, :non_existent2]
354
+ @m.header_order = order
355
+ msgstr = @m.to_s
356
+ idx = 0
357
+ order.each do |h|
358
+ next_idx = msgstr.index(SipperUtil.headerize(h)+": ")
359
+ if next_idx
360
+ assert(next_idx > idx)
361
+ idx = next_idx
362
+ end
363
+ end
364
+ end
365
+
366
+ def _make_message
367
+ @m = Request.create_initial("invite", "sip:bob@biloxi.com",
368
+ :p_asserted_identity => "sip:bobber@home.com",
369
+ :via => "SIP/2.0/UDP 127.0.0.1:6061;branch=z9hG4bK-2352-1-0",
370
+ :from => "sipp <sip:sipp@127.0.0.1:6061>;tag=1",
371
+ :to => "sut <sip:service@127.0.0.1:5060>;tag=azxs21",
372
+ :cseq => "1 INVITE")
373
+ end
374
+
375
+ def _check_mv_route(m)
376
+ assert_equal("<sip:r@oute1>", m.route.to_s)
377
+ assert_equal(["<sip:r@oute1>", "<sip:r@oute2>", "<sip:r@oute3>"], m.routes.map{|x| x.to_s})
378
+ assert_equal(["<sip:r@oute1>", "<sip:r@oute2>", "<sip:r@oute3>"], m[:route].map{|x| x.to_s})
379
+ end
380
+
381
+ def teardown
382
+ new_methods = Message.instance_methods - @orig_methods
383
+ new_methods.each do |m|
384
+ Message.class_eval do
385
+ undef_method m.to_sym
386
+ end
387
+ end
388
+ @m = nil
389
+ end
390
+
391
+ private :_make_message, :_check_mv_route
392
+ end
@@ -0,0 +1,81 @@
1
+
2
+ require 'driven_sip_test_case'
3
+
4
+
5
+ #
6
+ class TestMethodSpecificResponseHandling < DrivenSipTestCase
7
+
8
+ def setup
9
+ super
10
+ str = <<-EOF
11
+
12
+ require 'sip_test_driver_controller'
13
+
14
+ module SipInline
15
+ class UasMsrController < SIP::SipTestDriverController
16
+
17
+ transaction_usage :use_transactions=>true
18
+
19
+ def on_invite(session)
20
+ session.respond_with(200)
21
+ logd("Received INVITE sent a 200 from "+name)
22
+ end
23
+
24
+ def on_ack(session)
25
+ end
26
+
27
+
28
+
29
+ def on_bye(session)
30
+ session.respond_with(200)
31
+ session.invalidate(true)
32
+ end
33
+
34
+ def order
35
+ 0
36
+ end
37
+
38
+ end
39
+
40
+ class UacMsrController < SIP::SipTestDriverController
41
+
42
+ transaction_usage :use_transactions=>true
43
+
44
+ def start
45
+ r = Request.create_initial("invite", "sip:nasir@sipper.com", :p_session_record=>"msg-info")
46
+ u = create_udp_session(SipperConfigurator[:LocalSipperIP], SipperConfigurator[:LocalTestPort])
47
+ u.send(r)
48
+ logd("Sent a new INVITE from "+name)
49
+ end
50
+
51
+
52
+ def on_success_res_for_invite(session)
53
+ session.request_with('ACK')
54
+ session.request_with('BYE')
55
+ end
56
+
57
+ def on_success_res_for_bye(session)
58
+ session.invalidate(true)
59
+ session.flow_completed_for("TestMethodSpecificResponseHandling")
60
+ end
61
+
62
+
63
+ end
64
+ end
65
+ EOF
66
+ define_controller_from(str)
67
+ set_controller("SipInline::UacMsrController")
68
+ end
69
+
70
+
71
+ def test_smoke_controllers
72
+ self.expected_flow = ["> INVITE", "< 100", "< 200", "> ACK", "> BYE", "< 200"]
73
+ start_controller
74
+ verify_call_flow(:out)
75
+ self.expected_flow = ["< INVITE", "> 100", "> 200", "< ACK", "< BYE", "> 200"]
76
+ verify_call_flow(:in)
77
+ end
78
+
79
+ end
80
+
81
+