Changeset 420:c8a61dabea55 in freeDiameter for extensions/test_sip/test_sip.c
- Timestamp:
- Jul 19, 2010, 4:46:33 PM (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/test_sip/test_sip.c
r409 r420 38 38 #include"test_sip.h" 39 39 40 40 struct disp_hdl * test_sip_MAR_hdl=NULL; 41 struct disp_hdl * test_sip_LIR_hdl=NULL; 42 struct disp_hdl * test_sip_UAR_hdl=NULL; 43 struct disp_hdl * test_sip_SAR_hdl=NULL; 44 struct disp_hdl * test_sip_PPA_hdl=NULL; 45 struct disp_hdl * test_sip_RTA_hdl=NULL; 41 46 42 47 struct disp_hdl * test_sip_MAA_hdl=NULL; … … 53 58 //configuration stucture 54 59 struct ts_conf * ts_conf=NULL; 55 static struct ts_conf app_sip_conf; 60 static struct ts_conf test_sip_conf; 61 56 62 57 63 //dictionary of SIP 58 struct test_sip_dict sip_dict;64 struct sip_dict sip_dict; 59 65 60 66 int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act) … … 65 71 } 66 72 67 username = "awestfahl" 68 password = "test" 69 sip_aor = "sip:awestfahl@tera.ics.keio.ac.jp" 70 71 #Destination information 72 destination_realm = "freediameter.net" 73 destination_sip = "sip:awestfahl@freediameter.net" 74 73 74 /* 75 75 void dump_config() 76 76 { … … 83 83 TRACE_DEBUG(FULL,"***End of TEST Diameter-SIP configuration extension***"); 84 84 } 85 85 */ 86 86 static int ts_conf_init(void) 87 87 { … … 94 94 95 95 /* entry point */ 96 int as_entry(char * conffile)96 int ts_entry(char * conffile) 97 97 { 98 98 TRACE_ENTRY("%p", conffile); … … 101 101 struct disp_when data; 102 102 103 /* Initialize configuration */104 CHECK_FCT( ts_conf_init() );103 /* Initialize configuration 104 //CHECK_FCT( ts_conf_init() ); 105 105 106 106 … … 116 116 //We can dump the configuration extracted from app_sip.conf 117 117 dump_config(); 118 */ 119 118 120 119 121 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Session Initiation Protocol (SIP) Application", &app, ENOENT) ); … … 125 127 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Session-State", &sip_dict.Auth_Session_State, ENOENT) ); 126 128 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Application-Id", &sip_dict.Auth_Application_Id, ENOENT) ); 129 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Host", &sip_dict.Destination_Host, ENOENT) ); 130 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Destination-Realm", &sip_dict.Destination_Realm, ENOENT) ); 131 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Session-Id", &sip_dict.Session_Id, ENOENT) ); 127 132 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Auth-Data-Item", &sip_dict.SIP_Auth_Data_Item, ENOENT) ); 128 133 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Authorization", &sip_dict.SIP_Authorization, ENOENT) ); … … 134 139 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Method", &sip_dict.SIP_Method, ENOENT) ); 135 140 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-AOR", &sip_dict.SIP_AOR, ENOENT) ); 141 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Deregistration-Reason", &sip_dict.SIP_Deregistration_Reason, ENOENT) ); 142 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Reason-Code", &sip_dict.SIP_Reason_Code, ENOENT) ); 143 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Reason-Info", &sip_dict.SIP_Reason_Info, ENOENT) ); 136 144 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-Realm", &sip_dict.Digest_Realm, ENOENT) ); 137 145 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-URI", &sip_dict.Digest_URI, ENOENT) ); … … 157 165 158 166 //**Command Codes 167 /**/ 159 168 //MAR 160 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Request", &data.command, ENOENT) ); 161 CHECK_FCT( fd_disp_register( test_sip_MAR_cb, DISP_HOW_CC, &data, &test_sip_MAR_hdl ) ); 169 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Multimedia-Auth-Answer", &data.command, ENOENT) ); 170 CHECK_FCT( fd_disp_register( test_sip_MAA_cb, DISP_HOW_CC, &data, &test_sip_MAA_hdl ) ); 171 162 172 //RTR 163 173 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Registration-Termination-Request", &data.command, ENOENT) ); 164 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, &test_sip_RTA_hdl ) ); 174 CHECK_FCT( fd_disp_register( test_sip_RTR_cb, DISP_HOW_CC, &data, &test_sip_RTR_hdl ) ); 175 176 //LIA 177 CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_COMMAND, CMD_BY_NAME, "Location-Info-Answer", &data.command, ENOENT) ); 178 CHECK_FCT( fd_disp_register( test_sip_LIA_cb, DISP_HOW_CC, &data, &test_sip_LIA_hdl ) ); 165 179 166 180 … … 168 182 CHECK_FCT( fd_disp_register( test_sip_default_cb, DISP_HOW_APPID, &data, &test_sip_default_hdl ) ); 169 183 170 184 /* 171 185 //We start database connection 172 186 if(start_mysql_connection()) 173 187 return 1; 174 175 CHECK_FCT(fd_sess_handler_create(&ds_sess_hdl, free)); 188 */ 189 190 CHECK_FCT(fd_sess_handler_create(&ts_sess_hdl, free)); 191 CHECK_FCT( fd_sig_register(30, "test_sip", (void *)test_sip_LIR_cb ) ); 176 192 177 193 return 0; … … 181 197 void fd_ext_fini(void) 182 198 { 183 199 /* 184 200 if (test_sip_MAR_cb) { 185 201 (void) fd_disp_unregister(&test_sip_MAR_hdl); 186 202 CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl),return); 187 203 } 188 204 */ 189 205 //We close database connection 190 close_mysql_connection();206 //close_mysql_connection(); 191 207 192 208
Note: See TracChangeset
for help on using the changeset viewer.