Sipper 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/sipper/README.rb +26 -0
- data/sipper/b2bua_controller.rb +163 -0
- data/sipper/b2bua_session_mixin.rb +24 -0
- data/sipper/base_controller.rb +425 -0
- data/sipper/bin/common.rb +42 -0
- data/sipper/bin/generate.rb +70 -0
- data/sipper/bin/project.rb +44 -0
- data/sipper/bin/run.rb +85 -0
- data/sipper/bin/run_smoke.rb +8 -0
- data/sipper/config/log4r.xml +71 -0
- data/sipper/controller_class_loader.rb +29 -0
- data/sipper/controller_selector.rb +119 -0
- data/sipper/controllers/invite_controller.rb +30 -0
- data/sipper/controllers/order.yaml +3 -0
- data/sipper/custom_message.rb +4 -0
- data/sipper/detached_session.rb +11 -0
- data/sipper/docs/manual.txt +1621 -0
- data/sipper/generators/README +12 -0
- data/sipper/generators/gen_controller.rb +228 -0
- data/sipper/generators/gen_project.rb +45 -0
- data/sipper/generators/gen_test.rb +72 -0
- data/sipper/generators/project_template_dir/Rakefile +56 -0
- data/sipper/generators/project_template_dir/config/sipper.cfg +31 -0
- data/sipper/generators/project_template_dir/controllers/README.txt +2 -0
- data/sipper/generators/project_template_dir/dot_sipper.proj +2 -0
- data/sipper/generators/project_template_dir/logs/README.txt +2 -0
- data/sipper/generators/project_template_dir/tests/README.txt +2 -0
- data/sipper/lib/smc/statemap.rb +194 -0
- data/sipper/logs/dialog_info_store +0 -0
- data/sipper/logs/r.cmd +6 -0
- data/sipper/logs/r.sh +6 -0
- data/sipper/media/sipper_media_client.rb +268 -0
- data/sipper/media/sipper_media_event.rb +43 -0
- data/sipper/media/sipper_media_manager.rb +145 -0
- data/sipper/media/sipper_media_proxy.rb +60 -0
- data/sipper/media/sipper_offer_answer.rb +285 -0
- data/sipper/message.rb +512 -0
- data/sipper/modified_pattern_formatter.rb +119 -0
- data/sipper/proxy_controller.rb +143 -0
- data/sipper/registration.rb +52 -0
- data/sipper/request.rb +109 -0
- data/sipper/response.rb +123 -0
- data/sipper/ruby_ext/module.rb +27 -0
- data/sipper/ruby_ext/mutable_class.rb +17 -0
- data/sipper/ruby_ext/object.rb +38 -0
- data/sipper/ruby_ext/pqueue.rb +190 -0
- data/sipper/ruby_ext/snapshot.rb +201 -0
- data/sipper/ruby_ext/string.rb +18 -0
- data/sipper/ruby_ext/time.rb +9 -0
- data/sipper/run/run_sipper1.rb +28 -0
- data/sipper/run/run_sipper2.rb +56 -0
- data/sipper/sdp/sdp.rb +257 -0
- data/sipper/sdp/sdp_generator.rb +131 -0
- data/sipper/sdp/sdp_parser.rb +136 -0
- data/sipper/session.rb +1952 -0
- data/sipper/session_manager.rb +170 -0
- data/sipper/session_recorder.rb +190 -0
- data/sipper/session_state/DialogState.sm +54 -0
- data/sipper/session_state/DialogState_sm.rb +337 -0
- data/sipper/session_state/dialog_routes.rb +141 -0
- data/sipper/sip_headers/header.rb +632 -0
- data/sipper/sip_headers/sipuri.rb +352 -0
- data/sipper/sip_logger.rb +65 -0
- data/sipper/sip_message_router.rb +231 -0
- data/sipper/sip_test_driver_controller.rb +10 -0
- data/sipper/sipper.rb +329 -0
- data/sipper/sipper_assertions.rb +21 -0
- data/sipper/sipper_configurator.rb +376 -0
- data/sipper/sipper_http/sipper_http_request_dispatcher.rb +71 -0
- data/sipper/sipper_http/sipper_http_response.rb +25 -0
- data/sipper/stray_message_manager.rb +40 -0
- data/sipper/test_completion_signaling_helper.rb +77 -0
- data/sipper/transaction/Ict.sm +59 -0
- data/sipper/transaction/Ict_sm.rb +430 -0
- data/sipper/transaction/Ist.sm +74 -0
- data/sipper/transaction/Ist_sm.rb +460 -0
- data/sipper/transaction/Nict.sm +51 -0
- data/sipper/transaction/Nict_sm.rb +325 -0
- data/sipper/transaction/Nist.sm +59 -0
- data/sipper/transaction/Nist_sm.rb +356 -0
- data/sipper/transaction/invite_client_transaction.rb +274 -0
- data/sipper/transaction/invite_server_transaction.rb +319 -0
- data/sipper/transaction/non_invite_client_transaction.rb +230 -0
- data/sipper/transaction/non_invite_server_transaction.rb +263 -0
- data/sipper/transaction/state_machine_wrapper.rb +58 -0
- data/sipper/transaction/transaction.rb +212 -0
- data/sipper/transport/base_transport.rb +84 -0
- data/sipper/transport/rel_unrel.rb +19 -0
- data/sipper/transport/transport_and_route_resolver.rb +67 -0
- data/sipper/transport/udp_transport.rb +156 -0
- data/sipper/transport_manager.rb +33 -0
- data/sipper/udp_session.rb +17 -0
- data/sipper/util/command_element.rb +62 -0
- data/sipper/util/compact_converter.rb +50 -0
- data/sipper/util/counter.rb +26 -0
- data/sipper/util/digest/digest_authorizer.rb +204 -0
- data/sipper/util/expectation_parser.rb +164 -0
- data/sipper/util/locator.rb +31 -0
- data/sipper/util/message_fill.rb +58 -0
- data/sipper/util/persistence/ps_sipper_map.rb +63 -0
- data/sipper/util/persistence/sipper_map.rb +41 -0
- data/sipper/util/sipper_util.rb +305 -0
- data/sipper/util/timer/sip_timer_helper.rb +26 -0
- data/sipper/util/timer/timer_manager.rb +80 -0
- data/sipper/util/timer/timer_task.rb +56 -0
- data/sipper/util/validations.rb +44 -0
- data/sipper/version.rb +10 -0
- data/sipper_test/_test_media_uas.rb +79 -0
- data/sipper_test/base_test_case.rb +31 -0
- data/sipper_test/c_134.txt +7 -0
- data/sipper_test/driven_sip_test_case.rb +96 -0
- data/sipper_test/gold.txt +10 -0
- data/sipper_test/gold_res.txt +8 -0
- data/sipper_test/gold_sub.txt +9 -0
- data/sipper_test/hello_sipper.au +0 -0
- data/sipper_test/in_sipper.au +0 -0
- data/sipper_test/nonrr_proxy.rb +17 -0
- data/sipper_test/order_tests.yaml +4 -0
- data/sipper_test/rake_res.txt +399 -0
- data/sipper_test/rr_proxy.rb +17 -0
- data/sipper_test/run_test.cmd +94 -0
- data/sipper_test/sip_test_case.rb +104 -0
- data/sipper_test/test2xx_retransmission.rb +80 -0
- data/sipper_test/test2xx_retransmission_with_limit.rb +81 -0
- data/sipper_test/test2xx_retransmission_with_nist.rb +91 -0
- data/sipper_test/test2xx_retransmission_with_txns.rb +94 -0
- data/sipper_test/test_address_header.rb +66 -0
- data/sipper_test/test_b2bua1.rb +130 -0
- data/sipper_test/test_b2bua2.rb +120 -0
- data/sipper_test/test_b2bua3.rb +160 -0
- data/sipper_test/test_b2bua4.rb +130 -0
- data/sipper_test/test_base_controller.rb +110 -0
- data/sipper_test/test_base_transport.rb +37 -0
- data/sipper_test/test_cancel.rb +21 -0
- data/sipper_test/test_cancel_after2xx.rb +81 -0
- data/sipper_test/test_cancel_retransmission.rb +105 -0
- data/sipper_test/test_cancel_with481.rb +83 -0
- data/sipper_test/test_cancel_with487.rb +70 -0
- data/sipper_test/test_cancel_with_ist_without_nist.rb +99 -0
- data/sipper_test/test_cancel_with_nist.rb +84 -0
- data/sipper_test/test_cancel_without487.rb +77 -0
- data/sipper_test/test_command_element.rb +38 -0
- data/sipper_test/test_compact_converter.rb +33 -0
- data/sipper_test/test_controller_class_loader.rb +37 -0
- data/sipper_test/test_controller_selector.rb +53 -0
- data/sipper_test/test_controller_using_compact_headers.rb +74 -0
- data/sipper_test/test_controller_using_header_order.rb +85 -0
- data/sipper_test/test_controller_using_ict.rb +64 -0
- data/sipper_test/test_controller_using_ict_with_non_success.rb +72 -0
- data/sipper_test/test_controller_using_ict_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_ict_with_tcbh_no_action.rb +24 -0
- data/sipper_test/test_controller_using_ist.rb +70 -0
- data/sipper_test/test_controller_using_ist_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_nict.rb +115 -0
- data/sipper_test/test_controller_using_nict_with_tcbh.rb +24 -0
- data/sipper_test/test_controller_using_nist.rb +63 -0
- data/sipper_test/test_controller_using_pre_existing_rs0.rb +73 -0
- data/sipper_test/test_controller_using_pre_existing_rs1.rb +75 -0
- data/sipper_test/test_controller_using_pre_existing_rs2.rb +71 -0
- data/sipper_test/test_controller_using_route_set.rb +86 -0
- data/sipper_test/test_controller_with_sdp.rb +80 -0
- data/sipper_test/test_controllers/cancel/order.yaml +2 -0
- data/sipper_test/test_controllers/cancel/uac_cancel_controller.rb +35 -0
- data/sipper_test/test_controllers/cancel/uas_cancel_controller.rb +25 -0
- data/sipper_test/test_controllers/class_loading/ordered/first_ordered_controller.rb +5 -0
- data/sipper_test/test_controllers/class_loading/ordered/order.yaml +3 -0
- data/sipper_test/test_controllers/class_loading/ordered/recond_ordered_controller.rb +6 -0
- data/sipper_test/test_controllers/class_loading/ordered/second_ordered_controller.rb +6 -0
- data/sipper_test/test_controllers/class_loading/unordered/first_unordered_controller.rb +7 -0
- data/sipper_test/test_controllers/class_loading/unordered/second_unordered_controller.rb +6 -0
- data/sipper_test/test_controllers/ctrl_trhandler/lib/transport_filters/my_transport_handler.rb +22 -0
- data/sipper_test/test_controllers/ctrl_trhandler/uac_tr_handler_controller.rb +27 -0
- data/sipper_test/test_controllers/ctrl_trhandler/uas_tr_handler_controller.rb +21 -0
- data/sipper_test/test_controllers/ete/order.yaml +1 -0
- data/sipper_test/test_controllers/ete/uac_controller.rb +39 -0
- data/sipper_test/test_controllers/ete/uas_controller.rb +34 -0
- data/sipper_test/test_controllers/extensions/extension_uac_controller.rb +24 -0
- data/sipper_test/test_controllers/extensions/extension_uas_controller.rb +35 -0
- data/sipper_test/test_controllers/extensions/lib/sipper_extensions/my_from_extension.rb +16 -0
- data/sipper_test/test_controllers/ict_tcbh/lib/transaction_handlers/app_ict_handler.rb +23 -0
- data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_controller.rb +27 -0
- data/sipper_test/test_controllers/ict_tcbh/uac_ict_tcbh_no_action_controller.rb +28 -0
- data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_controller.rb +29 -0
- data/sipper_test/test_controllers/ict_tcbh/uas_ict_tcbh_no_action_controller.rb +31 -0
- data/sipper_test/test_controllers/ist_tcbh/lib/app_ist_handler.rb +13 -0
- data/sipper_test/test_controllers/ist_tcbh/uac_ist_tcbh_controller.rb +22 -0
- data/sipper_test/test_controllers/ist_tcbh/uas_ist_tcbh_controller.rb +31 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/in_order.yaml +2 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler1.rb +21 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/my_transport_handler2.rb +21 -0
- data/sipper_test/test_controllers/multi_trhandlers/lib/transport_filters/out_order.yaml +2 -0
- data/sipper_test/test_controllers/multi_trhandlers/uac_multi_tr_handler_controller.rb +27 -0
- data/sipper_test/test_controllers/multi_trhandlers/uas_multi_tr_handler_controller.rb +29 -0
- data/sipper_test/test_controllers/multiple/lib/blank_test.rb +2 -0
- data/sipper_test/test_controllers/multiple/uac_info_controller.rb +21 -0
- data/sipper_test/test_controllers/multiple/uac_msg_controller.rb +20 -0
- data/sipper_test/test_controllers/multiple/uas_info_controller.rb +15 -0
- data/sipper_test/test_controllers/multiple/uas_msg_controller.rb +14 -0
- data/sipper_test/test_controllers/nict_tcbh/lib/transaction_handlers/app_nict_handler.rb +13 -0
- data/sipper_test/test_controllers/nict_tcbh/uac_nict_tcbh_controller.rb +26 -0
- data/sipper_test/test_controllers/nict_tcbh/uas_nict_tcbh_controller.rb +20 -0
- data/sipper_test/test_controllers/state_machine_based/lib/CreditControl.sm +43 -0
- data/sipper_test/test_controllers/state_machine_based/lib/CreditControl_sm.rb +194 -0
- data/sipper_test/test_controllers/state_machine_based/order.yaml +1 -0
- data/sipper_test/test_controllers/state_machine_based/uac_message_controller.rb +34 -0
- data/sipper_test/test_controllers/state_machine_based/uas_message_controller.rb +44 -0
- data/sipper_test/test_controllers/stray_message/lib/sipper_extensions/my_stray_handler.rb +9 -0
- data/sipper_test/test_controllers/stray_message/stray_uac_controller.rb +24 -0
- data/sipper_test/test_controllers/stray_message/stray_uas_controller.rb +31 -0
- data/sipper_test/test_controllers/string/order.yaml +1 -0
- data/sipper_test/test_controllers/string/uac_controller.rb +29 -0
- data/sipper_test/test_controllers/string/uas_controller.rb +22 -0
- data/sipper_test/test_controllers/test_controller.rb +24 -0
- data/sipper_test/test_detached_session1.rb +78 -0
- data/sipper_test/test_dialog_routes.rb +139 -0
- data/sipper_test/test_digest_challenge1.rb +89 -0
- data/sipper_test/test_digest_challenge2.rb +90 -0
- data/sipper_test/test_dynamic_parse.rb +249 -0
- data/sipper_test/test_empty_sdp.rb +89 -0
- data/sipper_test/test_ete.rb +37 -0
- data/sipper_test/test_expectation_parser.rb +76 -0
- data/sipper_test/test_extensions.rb +28 -0
- data/sipper_test/test_freeze.rb +81 -0
- data/sipper_test/test_generated.rb +90 -0
- data/sipper_test/test_header_parameters.rb +75 -0
- data/sipper_test/test_header_parse.rb +141 -0
- data/sipper_test/test_http_client1.rb +84 -0
- data/sipper_test/test_http_client2.rb +90 -0
- data/sipper_test/test_ict_with_timeout.rb +62 -0
- data/sipper_test/test_in_dialog_request.rb +61 -0
- data/sipper_test/test_inline_controller.rb +67 -0
- data/sipper_test/test_invite_client_transaction.rb +272 -0
- data/sipper_test/test_invite_replace.rb +147 -0
- data/sipper_test/test_invite_retransmission.rb +90 -0
- data/sipper_test/test_invite_server_transaction.rb +208 -0
- data/sipper_test/test_lower_cseq.rb +79 -0
- data/sipper_test/test_media.rb +52 -0
- data/sipper_test/test_message.rb +392 -0
- data/sipper_test/test_method_specific_response_handling.rb +81 -0
- data/sipper_test/test_multi_homed1.rb +127 -0
- data/sipper_test/test_multi_homed2.rb +109 -0
- data/sipper_test/test_multi_homed_duplicate.rb +87 -0
- data/sipper_test/test_multi_homed_with_detached.rb +88 -0
- data/sipper_test/test_multiple.rb +49 -0
- data/sipper_test/test_multiple_contacts.rb +89 -0
- data/sipper_test/test_non2xx_retransmission_with_ist.rb +87 -0
- data/sipper_test/test_non_invite_client_transaction.rb +210 -0
- data/sipper_test/test_non_invite_retransmission.rb +91 -0
- data/sipper_test/test_non_invite_server_transaction.rb +202 -0
- data/sipper_test/test_offer_answer_prack.rb +103 -0
- data/sipper_test/test_pickup.rb +258 -0
- data/sipper_test/test_prack.rb +105 -0
- data/sipper_test/test_prack_store_and_dispatch.rb +101 -0
- data/sipper_test/test_prack_timer.rb +105 -0
- data/sipper_test/test_ps_sipper_map.rb +56 -0
- data/sipper_test/test_re_invite_uas_ongoing_ict.rb +81 -0
- data/sipper_test/test_re_invite_uas_ongoing_ist.rb +84 -0
- data/sipper_test/test_re_invite_with_ongoing_ict.rb +101 -0
- data/sipper_test/test_re_invite_with_ongoing_ist.rb +89 -0
- data/sipper_test/test_recorder_swap.rb +157 -0
- data/sipper_test/test_refer.rb +121 -0
- data/sipper_test/test_registeration_clearing.rb +97 -0
- data/sipper_test/test_registrar.rb +109 -0
- data/sipper_test/test_registration_controller.rb +73 -0
- data/sipper_test/test_registration_timeout.rb +90 -0
- data/sipper_test/test_remote_controller.rb +39 -0
- data/sipper_test/test_remote_target_update_on2xx.rb +140 -0
- data/sipper_test/test_request.rb +106 -0
- data/sipper_test/test_response.rb +40 -0
- data/sipper_test/test_response_without_to_tag.rb +92 -0
- data/sipper_test/test_rport.rb +88 -0
- data/sipper_test/test_sdp.rb +91 -0
- data/sipper_test/test_sdp_parser.rb +145 -0
- data/sipper_test/test_session.rb +276 -0
- data/sipper_test/test_session_callback_handler.rb +68 -0
- data/sipper_test/test_session_lifetime.rb +66 -0
- data/sipper_test/test_session_manager.rb +141 -0
- data/sipper_test/test_session_recorder.rb +145 -0
- data/sipper_test/test_session_state_user_defined.rb +84 -0
- data/sipper_test/test_session_states.rb +91 -0
- data/sipper_test/test_simple_dialog_state.rb +86 -0
- data/sipper_test/test_simple_re_invite.rb +86 -0
- data/sipper_test/test_sip_uri.rb +234 -0
- data/sipper_test/test_sipper_util.rb +45 -0
- data/sipper_test/test_smc_controller.rb +17 -0
- data/sipper_test/test_smoke.rb +80 -0
- data/sipper_test/test_stray.rb +28 -0
- data/sipper_test/test_stray_inline.rb +89 -0
- data/sipper_test/test_stray_res_acked.rb +103 -0
- data/sipper_test/test_stray_respond.rb +104 -0
- data/sipper_test/test_stray_retry.rb +92 -0
- data/sipper_test/test_stray_retry_failure.rb +93 -0
- data/sipper_test/test_stray_retry_initial.rb +100 -0
- data/sipper_test/test_strict_router_with_angled.rb +84 -0
- data/sipper_test/test_string_record.rb +31 -0
- data/sipper_test/test_subscribe_notify.rb +141 -0
- data/sipper_test/test_subscribe_notify_client_timeout.rb +158 -0
- data/sipper_test/test_subscribe_notify_dialog.rb +146 -0
- data/sipper_test/test_subscribe_notify_expires.rb +155 -0
- data/sipper_test/test_subscribe_notify_multiple_subscription.rb +157 -0
- data/sipper_test/test_subscribe_notify_server_timeout.rb +144 -0
- data/sipper_test/test_subsequent_unsent.rb +88 -0
- data/sipper_test/test_target_refresh_proxy_detached.rb +128 -0
- data/sipper_test/test_target_refresh_proxy_udp.rb +130 -0
- data/sipper_test/test_target_refresh_rr_proxy_udp.rb +133 -0
- data/sipper_test/test_target_refresh_with_new_port.rb +158 -0
- data/sipper_test/test_target_refresh_with_proxy1.rb +113 -0
- data/sipper_test/test_target_refresh_with_rr_update_proxy.rb +145 -0
- data/sipper_test/test_target_refresh_with_update_proxy.rb +144 -0
- data/sipper_test/test_target_refresh_with_update_proxy2.rb +139 -0
- data/sipper_test/test_timer_manager.rb +71 -0
- data/sipper_test/test_timer_task.rb +60 -0
- data/sipper_test/test_transport_handler.rb +19 -0
- data/sipper_test/test_transport_multi_handler.rb +18 -0
- data/sipper_test/test_udp_transport.rb +119 -0
- data/sipper_test/test_unparsed.rb +70 -0
- data/sipper_test/test_validations.rb +69 -0
- data/sipper_test/test_with_rr_proxy.rb +111 -0
- data/sipper_test/testmediacontroller.rb +71 -0
- data/sipper_test/tracing.rb +23 -0
- data/sipper_test/transaction_test_helper.rb +176 -0
- data/sipper_test/transport_filters.rb +26 -0
- data/sipper_test/ts_sipper.rb +91 -0
- data/sipper_test/ts_smoke.rb +3 -0
- data/sipper_test/tt.cmd +20 -0
- metadata +455 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
require 'monitor'
|
2
|
+
|
3
|
+
require 'session'
|
4
|
+
require 'sip_logger'
|
5
|
+
|
6
|
+
class SessionManager
|
7
|
+
include SipLogger
|
8
|
+
|
9
|
+
# When a new call is created and the request is sent out only From tag
|
10
|
+
# is present, at this time the entry is local_tag+call_id and the session
|
11
|
+
# gets in the half_dialogs hash.
|
12
|
+
#
|
13
|
+
# When a response is received, the full_dialogs is searched first, if not
|
14
|
+
# found then half_dialogs is searched. If the response is final and has a To tag
|
15
|
+
# we transition the session from half_dialogs hash to full_dialogs
|
16
|
+
# hash with the key as local_tag+call_id+remote_tag, actually half dialog entry still
|
17
|
+
# remains to absorb retransmissions.
|
18
|
+
#
|
19
|
+
# When request is received and it contains no To tag then a new session is
|
20
|
+
# created and entry goes to half dialogs when a response is sent out the session
|
21
|
+
# transitions to full_dialogs hash if the response is final.
|
22
|
+
#
|
23
|
+
# We do not remove the entry from the half dialog maps even when getting or receiving
|
24
|
+
# final responses. Instead we record the half dialog key in the session object and also
|
25
|
+
# add the session in the full dialog map. This is to take care of retransmission of both
|
26
|
+
# Request and Responses (if we retransmitted request before). Then entry shall be removed
|
27
|
+
# from the half dialog map when the transaction completes or on session termination.
|
28
|
+
#
|
29
|
+
# If a request is received with a To tag, only full_dialogs is searched.
|
30
|
+
#
|
31
|
+
# The session is removed either explicitly by calling invalidate or when
|
32
|
+
# timeout happens todo timeouts
|
33
|
+
#
|
34
|
+
@@full_dialogs = {}
|
35
|
+
# both local and remote dialogs are half dialogs
|
36
|
+
# local is for requests generated by us and remote
|
37
|
+
# or the far end UA. We transition to full map on dialog establishment from
|
38
|
+
# both of these.
|
39
|
+
@@half_dialogs = {}
|
40
|
+
@@sm_lock = Monitor.new
|
41
|
+
|
42
|
+
|
43
|
+
# Invoked on all incoming responses with or w/out remote tag
|
44
|
+
# and incoming requests with or without both tags.
|
45
|
+
# For requests without to tag a new session is created and when
|
46
|
+
# responded to, it transitions to full_dialogs from half dialogs
|
47
|
+
#
|
48
|
+
def SessionManager.find_session call_id, local, remote, final=false
|
49
|
+
SipLogger['siplog::sessionmanager'].info("Finding session for key |#{local}|#{call_id}|#{remote}|")
|
50
|
+
#SipLogger['siplog::sessionmanager'].debug("Half map at this time is #{@@half_dialogs.keys.join(',')}")
|
51
|
+
#SipLogger['siplog::sessionmanager'].debug("Full map at this time is #{@@full_dialogs.keys.join(',')}")
|
52
|
+
s = nil
|
53
|
+
key = sprintf("|%s|%s|%s|",local, call_id, remote)
|
54
|
+
@@sm_lock.synchronize do
|
55
|
+
if remote
|
56
|
+
if local
|
57
|
+
s = @@full_dialogs[key]
|
58
|
+
unless s
|
59
|
+
SipLogger['siplog::sessionmanager'].info("Not found in full dialog map looking in half")
|
60
|
+
key_l = sprintf("|%s|%s|%s|",local, call_id, nil)
|
61
|
+
if (s = @@half_dialogs[key_l])
|
62
|
+
if final
|
63
|
+
#@@half_dialogs[key_l] = nil #instead of removing from half, just record half dialog.
|
64
|
+
s.half_dialog_key = key_l
|
65
|
+
s.session_map = :full
|
66
|
+
s.session_key = key
|
67
|
+
SipLogger['siplog::sessionmanager'].info("Found in half copying to full")
|
68
|
+
else
|
69
|
+
SipLogger['siplog::sessionmanager'].info("Found in half NOT copying to full")
|
70
|
+
end
|
71
|
+
@@full_dialogs[key] = s
|
72
|
+
end
|
73
|
+
else
|
74
|
+
SipLogger['siplog::sessionmanager'].info("Found in the full dialogs map")
|
75
|
+
# cleaning up in case a NOTIFY came before 2xx and now we have 2xx
|
76
|
+
if final
|
77
|
+
key_l = sprintf("|%s|%s|%s|",local, call_id, nil)
|
78
|
+
#@@half_dialogs[key_l] = nil #instead of removing from half, just record half dialog.
|
79
|
+
s.half_dialog_key = key_l
|
80
|
+
s.session_map = :full
|
81
|
+
s.session_key = key
|
82
|
+
SipLogger['siplog::sessionmanager'].info("Found in full NOW moving to full")
|
83
|
+
end
|
84
|
+
end
|
85
|
+
else #local not present but remote present
|
86
|
+
s = @@half_dialogs[key]
|
87
|
+
end
|
88
|
+
else #remote not present
|
89
|
+
s = @@half_dialogs[key]
|
90
|
+
end
|
91
|
+
end
|
92
|
+
return s
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
# addition of session happens on new req out, resp out for new req,
|
97
|
+
# But this is called whenever any message is being sent out. If both the
|
98
|
+
# local and remote tags are present then add in the full_dialogs hash, otherwise
|
99
|
+
# just add in the half_dialogs hash, in both cases mark in the session
|
100
|
+
# if the session was in half dialog hash and you are adding in full then remove
|
101
|
+
# from HD Map. If the session is already in full then do not do anything.
|
102
|
+
|
103
|
+
def SessionManager.add_session session, final=false
|
104
|
+
SipLogger['siplog::sessionmanager'].debug("Trying to add session with session.session_map #{session.session_map} local_tag=#{session.local_tag} and remote_tag=#{session.remote_tag}")
|
105
|
+
if session.session_map == :full && !session.force_update_session_map
|
106
|
+
SipLogger['siplog::sessionmanager'].info("Already in full map")
|
107
|
+
return
|
108
|
+
end
|
109
|
+
if ((session.session_map == :half) &&
|
110
|
+
!(session.remote_tag && session.local_tag)) &&
|
111
|
+
!session.force_update_session_map
|
112
|
+
SipLogger['siplog::sessionmanager'].info("Already in half map, nothing new")
|
113
|
+
return
|
114
|
+
end
|
115
|
+
key = sprintf("|%s|%s|%s|", session.local_tag, session.call_id, session.remote_tag)
|
116
|
+
if session.remote_tag
|
117
|
+
if session.local_tag
|
118
|
+
@@sm_lock.synchronize do
|
119
|
+
@@full_dialogs[key] = session
|
120
|
+
#@@half_dialogs[session.session_key] = nil if ((session.session_map == :half) && final)
|
121
|
+
session.half_dialog_key = session.session_key
|
122
|
+
end
|
123
|
+
session.session_map = :full
|
124
|
+
else # incoming request and 100 responses out
|
125
|
+
@@sm_lock.synchronize do
|
126
|
+
@@half_dialogs[key] = session
|
127
|
+
end
|
128
|
+
session.session_map = :half
|
129
|
+
end
|
130
|
+
else
|
131
|
+
@@sm_lock.synchronize do
|
132
|
+
@@half_dialogs[key] = session
|
133
|
+
end
|
134
|
+
session.session_map = :half
|
135
|
+
end
|
136
|
+
SipLogger['siplog::sessionmanager'].debug("Setting the session_key as #{key}")
|
137
|
+
session.session_key = key
|
138
|
+
end
|
139
|
+
|
140
|
+
|
141
|
+
def SessionManager.remove_session session, half_only=false
|
142
|
+
@@sm_lock.synchronize do
|
143
|
+
@@half_dialogs[session.half_dialog_key] = nil if session.half_dialog_key
|
144
|
+
SipLogger['siplog::sessionmanager'].info("Removed session with key #{session.half_dialog_key} from half_dialogs map")
|
145
|
+
return if half_only
|
146
|
+
end
|
147
|
+
if session.session_map == :full
|
148
|
+
@@sm_lock.synchronize do
|
149
|
+
@@full_dialogs[session.session_key] = nil
|
150
|
+
end
|
151
|
+
SipLogger['siplog::sessionmanager'].info("Removed session with key #{session.session_key} from full_dialogs map")
|
152
|
+
elsif session.session_map == :half
|
153
|
+
@@sm_lock.synchronize do
|
154
|
+
@@half_dialogs[session.session_key] = nil
|
155
|
+
end
|
156
|
+
SipLogger['siplog::sessionmanager'].info("Removed session with key #{session.session_key} from half_dialogs map")
|
157
|
+
else
|
158
|
+
SipLogger['siplog::sessionmanager'].warn("Session with call_id #{session.call_id } does not have any map information")
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def SessionManager.clean_all
|
163
|
+
@@sm_lock.synchronize do
|
164
|
+
@@full_dialogs = {}
|
165
|
+
@@half_dialogs = {}
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
|
170
|
+
end
|
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'sipper_configurator'
|
3
|
+
require 'message'
|
4
|
+
|
5
|
+
# Recording of a session happens, either when you have
|
6
|
+
# the global setting for recording :SessionRecord= true or you
|
7
|
+
# get the P header P-Session-Record, the values for the global
|
8
|
+
# var or the header can be "msg-info" or "msg-debug"
|
9
|
+
# msg-info just records the in-out messages and msg-debug records
|
10
|
+
# full SIP messages.
|
11
|
+
#
|
12
|
+
|
13
|
+
require 'sip_logger'
|
14
|
+
require 'stringio'
|
15
|
+
require 'monitor'
|
16
|
+
|
17
|
+
class SessionRecorder
|
18
|
+
include SipLogger
|
19
|
+
|
20
|
+
attr_accessor :level
|
21
|
+
|
22
|
+
private_class_method :new
|
23
|
+
|
24
|
+
@@count = 0
|
25
|
+
@@val = 0
|
26
|
+
@@base = 0
|
27
|
+
@@class_lock = Monitor.new
|
28
|
+
|
29
|
+
def SessionRecorder.get_new_count
|
30
|
+
@@class_lock.synchronize do
|
31
|
+
@@count += 1
|
32
|
+
if @@count == 10
|
33
|
+
@@count = 0
|
34
|
+
@@base = @@val*10
|
35
|
+
end
|
36
|
+
@@val = @@base + @@count
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def SessionRecorder.create_and_record(io, msg, msg_s, direction, session_setting=nil)
|
41
|
+
if msg[:p_session_record]
|
42
|
+
level = msg.p_session_record.to_s
|
43
|
+
elsif session_setting
|
44
|
+
level = session_setting
|
45
|
+
else
|
46
|
+
level = SipperConfigurator[:SessionRecord]
|
47
|
+
end
|
48
|
+
if level
|
49
|
+
if io
|
50
|
+
sr = new(nil, io, level)
|
51
|
+
else
|
52
|
+
sr = new(SessionRecorder.get_new_count.to_s+"_"+msg.call_id.to_s+"_"+direction , nil, level)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
sr.record(direction, msg, msg_s) if sr
|
56
|
+
return sr
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def initialize(f, io, l="msg-info")
|
61
|
+
@messages = []
|
62
|
+
@io = io
|
63
|
+
@level = l
|
64
|
+
path = SipperConfigurator[:SessionRecordPath]||SipperConfigurator[:LogPath]
|
65
|
+
@filename = File.join(path, f) if f
|
66
|
+
@recordable = true
|
67
|
+
end
|
68
|
+
|
69
|
+
def io=(io)
|
70
|
+
ensure_recordable
|
71
|
+
@io.close if @io
|
72
|
+
@io = io
|
73
|
+
end
|
74
|
+
|
75
|
+
def open_file_if_unopened
|
76
|
+
return if @io
|
77
|
+
io = File.new(@filename, "w+")
|
78
|
+
io.flock(File::LOCK_EX) if SipperConfigurator[:EnableRecordingLock]
|
79
|
+
self.io = io
|
80
|
+
end
|
81
|
+
|
82
|
+
# Record takes both sip message and also the optional string representation of
|
83
|
+
# the message as the message is filled as we go along the stack and populate the
|
84
|
+
# message. The string representation is the final string that goes out from the
|
85
|
+
# transport.
|
86
|
+
|
87
|
+
def record(direction, msg, msg_s=nil )
|
88
|
+
ensure_recordable
|
89
|
+
open_file_if_unopened
|
90
|
+
case @level
|
91
|
+
when "msg-info"
|
92
|
+
if msg.class == Request
|
93
|
+
m = msg.method
|
94
|
+
elsif msg.class == Response
|
95
|
+
m = msg.code.to_s
|
96
|
+
else
|
97
|
+
m = msg.to_s
|
98
|
+
end
|
99
|
+
when "msg-debug"
|
100
|
+
m = msg_s.nil? ? msg.to_s : msg_s
|
101
|
+
else
|
102
|
+
m = "Unknown_record_level #{@level}, I know only msg-info and msg-debug"
|
103
|
+
end
|
104
|
+
if direction == "in"
|
105
|
+
m = "< " + m
|
106
|
+
elsif direction == "out"
|
107
|
+
m = "> " + m
|
108
|
+
elsif direction == "neutral"
|
109
|
+
m = "! " + m
|
110
|
+
else
|
111
|
+
m = "UNKNOWN DIRECTION " + m
|
112
|
+
end
|
113
|
+
@messages << m
|
114
|
+
end
|
115
|
+
|
116
|
+
def get_recording
|
117
|
+
@messages
|
118
|
+
end
|
119
|
+
|
120
|
+
def get_info_only_recording
|
121
|
+
return @messages if @level == "msg-info"
|
122
|
+
@messages.map do |msg|
|
123
|
+
prefix = msg[0..1]
|
124
|
+
message = msg[2..-1]
|
125
|
+
unless prefix == "! " #neutral
|
126
|
+
begin
|
127
|
+
m = Message.parse([message, ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]])
|
128
|
+
if m.class == Request
|
129
|
+
prefix + m.method
|
130
|
+
elsif m.class == Response
|
131
|
+
prefix + m.code.to_s
|
132
|
+
end
|
133
|
+
rescue ArgumentError
|
134
|
+
msg
|
135
|
+
end
|
136
|
+
else
|
137
|
+
msg
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
def save
|
144
|
+
ensure_recordable
|
145
|
+
logd("Trying to save the recording in #{@io.path||@io}")
|
146
|
+
@recordable = false
|
147
|
+
begin
|
148
|
+
@io.write(YAML::dump(self))
|
149
|
+
@io.flush
|
150
|
+
ensure
|
151
|
+
@io.flock(File::LOCK_UN) if @io.class == File if SipperConfigurator[:EnableRecordingLock]
|
152
|
+
@io.close unless @io.class == StringIO
|
153
|
+
end
|
154
|
+
logd("Saved the recording in #{@io.path||@io}")
|
155
|
+
end
|
156
|
+
|
157
|
+
def SessionRecorder.load(f)
|
158
|
+
SipLogger['siplog::sessionrecorder'].debug("Reading the recording from #{f}")
|
159
|
+
begin
|
160
|
+
case f
|
161
|
+
when String
|
162
|
+
io = File.new(f, "r")
|
163
|
+
io.flock(File::LOCK_EX) if SipperConfigurator[:EnableRecordingLock]
|
164
|
+
when StringIO
|
165
|
+
io = f
|
166
|
+
end
|
167
|
+
obj = YAML::load(io)
|
168
|
+
if obj.class == SessionRecorder
|
169
|
+
return obj
|
170
|
+
else
|
171
|
+
msg = "Object read from file #{f} is not a recording"
|
172
|
+
SipLogger['siplog::sessionrecorder'].error(msg)
|
173
|
+
raise TypeError, msg
|
174
|
+
end
|
175
|
+
rescue IOError
|
176
|
+
msg = "#{f} is not a proper file"
|
177
|
+
SipLogger['siplog::sessionrecorder'].error(msg)
|
178
|
+
raise TypeError, msg
|
179
|
+
ensure
|
180
|
+
io.flock(File::LOCK_UN) if io.class == File if SipperConfigurator[:EnableRecordingLock]
|
181
|
+
io.close if io
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def ensure_recordable
|
186
|
+
raise RuntimeError, "This recorder is now closed for recording" unless @recordable
|
187
|
+
end
|
188
|
+
|
189
|
+
private :open_file_if_unopened, :ensure_recordable
|
190
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// Dialog state machine, refer to RFC 4235
|
2
|
+
// This is not being used currently, put here for future
|
3
|
+
|
4
|
+
%class Dsm
|
5
|
+
|
6
|
+
%start DsmMap::Trying
|
7
|
+
|
8
|
+
%map DsmMap
|
9
|
+
|
10
|
+
%%
|
11
|
+
|
12
|
+
Trying
|
13
|
+
{
|
14
|
+
one_xx_no_tag Proceeding {}
|
15
|
+
one_xx_tag Early {}
|
16
|
+
two_xx Confirmed {}
|
17
|
+
cancelled_rejected Terminated {}
|
18
|
+
three_xx Terminated {}
|
19
|
+
}
|
20
|
+
|
21
|
+
|
22
|
+
Proceeding
|
23
|
+
{
|
24
|
+
one_xx_tag Early {}
|
25
|
+
two_xx Confirmed {}
|
26
|
+
cancelled_rejected Terminated {}
|
27
|
+
three_xx Terminated {}
|
28
|
+
}
|
29
|
+
|
30
|
+
Early
|
31
|
+
{
|
32
|
+
replaced Terminated {}
|
33
|
+
two_xx Confirmed {}
|
34
|
+
one_xx_tag nil {}
|
35
|
+
three_xx Terminated {}
|
36
|
+
}
|
37
|
+
|
38
|
+
Confirmed
|
39
|
+
{
|
40
|
+
error Terminated {}
|
41
|
+
timeout Terminated {}
|
42
|
+
replaced Terminated {}
|
43
|
+
bye Terminated {}
|
44
|
+
two_xx nil {}
|
45
|
+
}
|
46
|
+
|
47
|
+
Terminated
|
48
|
+
{
|
49
|
+
timeout nil {}
|
50
|
+
bye nil {}
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
%%
|
@@ -0,0 +1,337 @@
|
|
1
|
+
# DO NOT EDIT.
|
2
|
+
# generated by smc (http://smc.sourceforge.net/)
|
3
|
+
# from file : DialogState.sm
|
4
|
+
|
5
|
+
require 'statemap'
|
6
|
+
|
7
|
+
class DsmState < Statemap::State
|
8
|
+
|
9
|
+
def Entry(fsm) end
|
10
|
+
|
11
|
+
def Exit(fsm) end
|
12
|
+
|
13
|
+
def bye(fsm)
|
14
|
+
Default(fsm)
|
15
|
+
end
|
16
|
+
|
17
|
+
def cancelled_rejected(fsm)
|
18
|
+
Default(fsm)
|
19
|
+
end
|
20
|
+
|
21
|
+
def error(fsm)
|
22
|
+
Default(fsm)
|
23
|
+
end
|
24
|
+
|
25
|
+
def one_xx_no_tag(fsm)
|
26
|
+
Default(fsm)
|
27
|
+
end
|
28
|
+
|
29
|
+
def one_xx_tag(fsm)
|
30
|
+
Default(fsm)
|
31
|
+
end
|
32
|
+
|
33
|
+
def replaced(fsm)
|
34
|
+
Default(fsm)
|
35
|
+
end
|
36
|
+
|
37
|
+
def three_xx(fsm)
|
38
|
+
Default(fsm)
|
39
|
+
end
|
40
|
+
|
41
|
+
def timeout(fsm)
|
42
|
+
Default(fsm)
|
43
|
+
end
|
44
|
+
|
45
|
+
def two_xx(fsm)
|
46
|
+
Default(fsm)
|
47
|
+
end
|
48
|
+
|
49
|
+
def Default(fsm)
|
50
|
+
if fsm.getDebugFlag then
|
51
|
+
fsm.getDebugStream.write("TRANSITION : Default\n")
|
52
|
+
end
|
53
|
+
msg = "\nState: " + fsm.getState.getName +
|
54
|
+
"\nTransition: " + fsm.getTransition + "\n"
|
55
|
+
raise Statemap::TransitionUndefinedException, msg
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
class DsmMap_Default < DsmState
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
class DsmMap_Trying < DsmMap_Default
|
65
|
+
|
66
|
+
def cancelled_rejected(fsm)
|
67
|
+
if fsm.getDebugFlag then
|
68
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Trying.cancelled_rejected\n")
|
69
|
+
end
|
70
|
+
fsm.getState.Exit(fsm)
|
71
|
+
fsm.setState(DsmMap::Terminated)
|
72
|
+
fsm.getState.Entry(fsm)
|
73
|
+
end
|
74
|
+
|
75
|
+
def one_xx_no_tag(fsm)
|
76
|
+
if fsm.getDebugFlag then
|
77
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Trying.one_xx_no_tag\n")
|
78
|
+
end
|
79
|
+
fsm.getState.Exit(fsm)
|
80
|
+
fsm.setState(DsmMap::Proceeding)
|
81
|
+
fsm.getState.Entry(fsm)
|
82
|
+
end
|
83
|
+
|
84
|
+
def one_xx_tag(fsm)
|
85
|
+
if fsm.getDebugFlag then
|
86
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Trying.one_xx_tag\n")
|
87
|
+
end
|
88
|
+
fsm.getState.Exit(fsm)
|
89
|
+
fsm.setState(DsmMap::Early)
|
90
|
+
fsm.getState.Entry(fsm)
|
91
|
+
end
|
92
|
+
|
93
|
+
def three_xx(fsm)
|
94
|
+
if fsm.getDebugFlag then
|
95
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Trying.three_xx\n")
|
96
|
+
end
|
97
|
+
fsm.getState.Exit(fsm)
|
98
|
+
fsm.setState(DsmMap::Terminated)
|
99
|
+
fsm.getState.Entry(fsm)
|
100
|
+
end
|
101
|
+
|
102
|
+
def two_xx(fsm)
|
103
|
+
if fsm.getDebugFlag then
|
104
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Trying.two_xx\n")
|
105
|
+
end
|
106
|
+
fsm.getState.Exit(fsm)
|
107
|
+
fsm.setState(DsmMap::Confirmed)
|
108
|
+
fsm.getState.Entry(fsm)
|
109
|
+
end
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
class DsmMap_Proceeding < DsmMap_Default
|
114
|
+
|
115
|
+
def cancelled_rejected(fsm)
|
116
|
+
if fsm.getDebugFlag then
|
117
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Proceeding.cancelled_rejected\n")
|
118
|
+
end
|
119
|
+
fsm.getState.Exit(fsm)
|
120
|
+
fsm.setState(DsmMap::Terminated)
|
121
|
+
fsm.getState.Entry(fsm)
|
122
|
+
end
|
123
|
+
|
124
|
+
def one_xx_tag(fsm)
|
125
|
+
if fsm.getDebugFlag then
|
126
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Proceeding.one_xx_tag\n")
|
127
|
+
end
|
128
|
+
fsm.getState.Exit(fsm)
|
129
|
+
fsm.setState(DsmMap::Early)
|
130
|
+
fsm.getState.Entry(fsm)
|
131
|
+
end
|
132
|
+
|
133
|
+
def three_xx(fsm)
|
134
|
+
if fsm.getDebugFlag then
|
135
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Proceeding.three_xx\n")
|
136
|
+
end
|
137
|
+
fsm.getState.Exit(fsm)
|
138
|
+
fsm.setState(DsmMap::Terminated)
|
139
|
+
fsm.getState.Entry(fsm)
|
140
|
+
end
|
141
|
+
|
142
|
+
def two_xx(fsm)
|
143
|
+
if fsm.getDebugFlag then
|
144
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Proceeding.two_xx\n")
|
145
|
+
end
|
146
|
+
fsm.getState.Exit(fsm)
|
147
|
+
fsm.setState(DsmMap::Confirmed)
|
148
|
+
fsm.getState.Entry(fsm)
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
152
|
+
|
153
|
+
class DsmMap_Early < DsmMap_Default
|
154
|
+
|
155
|
+
def one_xx_tag(fsm)
|
156
|
+
if fsm.getDebugFlag then
|
157
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Early.one_xx_tag\n")
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def replaced(fsm)
|
162
|
+
if fsm.getDebugFlag then
|
163
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Early.replaced\n")
|
164
|
+
end
|
165
|
+
fsm.getState.Exit(fsm)
|
166
|
+
fsm.setState(DsmMap::Terminated)
|
167
|
+
fsm.getState.Entry(fsm)
|
168
|
+
end
|
169
|
+
|
170
|
+
def three_xx(fsm)
|
171
|
+
if fsm.getDebugFlag then
|
172
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Early.three_xx\n")
|
173
|
+
end
|
174
|
+
fsm.getState.Exit(fsm)
|
175
|
+
fsm.setState(DsmMap::Terminated)
|
176
|
+
fsm.getState.Entry(fsm)
|
177
|
+
end
|
178
|
+
|
179
|
+
def two_xx(fsm)
|
180
|
+
if fsm.getDebugFlag then
|
181
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Early.two_xx\n")
|
182
|
+
end
|
183
|
+
fsm.getState.Exit(fsm)
|
184
|
+
fsm.setState(DsmMap::Confirmed)
|
185
|
+
fsm.getState.Entry(fsm)
|
186
|
+
end
|
187
|
+
|
188
|
+
end
|
189
|
+
|
190
|
+
class DsmMap_Confirmed < DsmMap_Default
|
191
|
+
|
192
|
+
def bye(fsm)
|
193
|
+
if fsm.getDebugFlag then
|
194
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Confirmed.bye\n")
|
195
|
+
end
|
196
|
+
fsm.getState.Exit(fsm)
|
197
|
+
fsm.setState(DsmMap::Terminated)
|
198
|
+
fsm.getState.Entry(fsm)
|
199
|
+
end
|
200
|
+
|
201
|
+
def error(fsm)
|
202
|
+
if fsm.getDebugFlag then
|
203
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Confirmed.error\n")
|
204
|
+
end
|
205
|
+
fsm.getState.Exit(fsm)
|
206
|
+
fsm.setState(DsmMap::Terminated)
|
207
|
+
fsm.getState.Entry(fsm)
|
208
|
+
end
|
209
|
+
|
210
|
+
def replaced(fsm)
|
211
|
+
if fsm.getDebugFlag then
|
212
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Confirmed.replaced\n")
|
213
|
+
end
|
214
|
+
fsm.getState.Exit(fsm)
|
215
|
+
fsm.setState(DsmMap::Terminated)
|
216
|
+
fsm.getState.Entry(fsm)
|
217
|
+
end
|
218
|
+
|
219
|
+
def timeout(fsm)
|
220
|
+
if fsm.getDebugFlag then
|
221
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Confirmed.timeout\n")
|
222
|
+
end
|
223
|
+
fsm.getState.Exit(fsm)
|
224
|
+
fsm.setState(DsmMap::Terminated)
|
225
|
+
fsm.getState.Entry(fsm)
|
226
|
+
end
|
227
|
+
|
228
|
+
def two_xx(fsm)
|
229
|
+
if fsm.getDebugFlag then
|
230
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Confirmed.two_xx\n")
|
231
|
+
end
|
232
|
+
end
|
233
|
+
|
234
|
+
end
|
235
|
+
|
236
|
+
class DsmMap_Terminated < DsmMap_Default
|
237
|
+
|
238
|
+
def bye(fsm)
|
239
|
+
if fsm.getDebugFlag then
|
240
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Terminated.bye\n")
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
def timeout(fsm)
|
245
|
+
if fsm.getDebugFlag then
|
246
|
+
fsm.getDebugStream.write("TRANSITION : DsmMap::Terminated.timeout\n")
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
|
252
|
+
module DsmMap
|
253
|
+
|
254
|
+
Trying = DsmMap_Trying::new('DsmMap.Trying', 0).freeze
|
255
|
+
Proceeding = DsmMap_Proceeding::new('DsmMap.Proceeding', 1).freeze
|
256
|
+
Early = DsmMap_Early::new('DsmMap.Early', 2).freeze
|
257
|
+
Confirmed = DsmMap_Confirmed::new('DsmMap.Confirmed', 3).freeze
|
258
|
+
Terminated = DsmMap_Terminated::new('DsmMap.Terminated', 4).freeze
|
259
|
+
Default = DsmMap_Default::new('DsmMap.Default', -1).freeze
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
class Dsm_sm < Statemap::FSMContext
|
264
|
+
|
265
|
+
def initialize(owner)
|
266
|
+
super()
|
267
|
+
@_owner = owner
|
268
|
+
setState(DsmMap::Trying)
|
269
|
+
DsmMap::Trying.Entry(self)
|
270
|
+
end
|
271
|
+
|
272
|
+
def bye()
|
273
|
+
@_transition = 'bye'
|
274
|
+
getState.bye(self)
|
275
|
+
@_transition = nil
|
276
|
+
end
|
277
|
+
|
278
|
+
def cancelled_rejected()
|
279
|
+
@_transition = 'cancelled_rejected'
|
280
|
+
getState.cancelled_rejected(self)
|
281
|
+
@_transition = nil
|
282
|
+
end
|
283
|
+
|
284
|
+
def error()
|
285
|
+
@_transition = 'error'
|
286
|
+
getState.error(self)
|
287
|
+
@_transition = nil
|
288
|
+
end
|
289
|
+
|
290
|
+
def one_xx_no_tag()
|
291
|
+
@_transition = 'one_xx_no_tag'
|
292
|
+
getState.one_xx_no_tag(self)
|
293
|
+
@_transition = nil
|
294
|
+
end
|
295
|
+
|
296
|
+
def one_xx_tag()
|
297
|
+
@_transition = 'one_xx_tag'
|
298
|
+
getState.one_xx_tag(self)
|
299
|
+
@_transition = nil
|
300
|
+
end
|
301
|
+
|
302
|
+
def replaced()
|
303
|
+
@_transition = 'replaced'
|
304
|
+
getState.replaced(self)
|
305
|
+
@_transition = nil
|
306
|
+
end
|
307
|
+
|
308
|
+
def three_xx()
|
309
|
+
@_transition = 'three_xx'
|
310
|
+
getState.three_xx(self)
|
311
|
+
@_transition = nil
|
312
|
+
end
|
313
|
+
|
314
|
+
def timeout()
|
315
|
+
@_transition = 'timeout'
|
316
|
+
getState.timeout(self)
|
317
|
+
@_transition = nil
|
318
|
+
end
|
319
|
+
|
320
|
+
def two_xx()
|
321
|
+
@_transition = 'two_xx'
|
322
|
+
getState.two_xx(self)
|
323
|
+
@_transition = nil
|
324
|
+
end
|
325
|
+
|
326
|
+
def getState()
|
327
|
+
if @_state.nil? then
|
328
|
+
raise Statemap::StateUndefinedException
|
329
|
+
end
|
330
|
+
return @_state
|
331
|
+
end
|
332
|
+
|
333
|
+
def getOwner()
|
334
|
+
return @_owner
|
335
|
+
end
|
336
|
+
|
337
|
+
end
|