Navigation


Changeset 420:c8a61dabea55 in freeDiameter for extensions/test_sip/test_sip.c


Ignore:
Timestamp:
Jul 19, 2010, 4:46:33 PM (14 years ago)
Author:
Alexandre Westfahl <awestfahl@freediameter.net>
Branch:
default
Phase:
public
Message:

app_sip:Added LIR/LIA for SL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/test_sip/test_sip.c

    r409 r420  
    3838#include"test_sip.h"
    3939
    40 
     40struct disp_hdl * test_sip_MAR_hdl=NULL;
     41struct disp_hdl * test_sip_LIR_hdl=NULL;
     42struct disp_hdl * test_sip_UAR_hdl=NULL;
     43struct disp_hdl * test_sip_SAR_hdl=NULL;
     44struct disp_hdl * test_sip_PPA_hdl=NULL;
     45struct disp_hdl * test_sip_RTA_hdl=NULL;
    4146
    4247struct disp_hdl * test_sip_MAA_hdl=NULL;
     
    5358//configuration stucture
    5459struct ts_conf * ts_conf=NULL;
    55 static struct ts_conf app_sip_conf;
     60static struct ts_conf test_sip_conf;
     61
    5662
    5763//dictionary of SIP
    58 struct test_sip_dict sip_dict;
     64struct sip_dict sip_dict;
    5965
    6066int test_sip_default_cb( struct msg ** msg, struct avp * avp, struct session * sess, enum disp_action * act)
     
    6571}
    6672
    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/*
    7575void dump_config()
    7676{
     
    8383        TRACE_DEBUG(FULL,"***End of TEST Diameter-SIP configuration extension***");
    8484}
    85 
     85*/
    8686static int ts_conf_init(void)
    8787{
     
    9494
    9595/* entry point */
    96 int as_entry(char * conffile)
     96int ts_entry(char * conffile)
    9797{
    9898        TRACE_ENTRY("%p", conffile);
     
    101101        struct disp_when data;
    102102       
    103         /* Initialize configuration */
    104         CHECK_FCT( ts_conf_init() );
     103        /* Initialize configuration
     104        //CHECK_FCT( ts_conf_init() );
    105105       
    106106       
     
    116116        //We can dump the configuration extracted from app_sip.conf
    117117        dump_config();
     118        */
     119       
    118120       
    119121        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_APPLICATION, APPLICATION_BY_NAME, "Diameter Session Initiation Protocol (SIP) Application", &app, ENOENT) );
     
    125127        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Auth-Session-State", &sip_dict.Auth_Session_State, ENOENT) );
    126128        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) );
    127132        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) );
    128133        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Authorization", &sip_dict.SIP_Authorization, ENOENT) );
     
    134139        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "SIP-Method", &sip_dict.SIP_Method, ENOENT) );
    135140        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) );
    136144        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-Realm", &sip_dict.Digest_Realm, ENOENT) );
    137145        CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, DICT_AVP, AVP_BY_NAME, "Digest-URI", &sip_dict.Digest_URI, ENOENT) );
     
    157165       
    158166        //**Command Codes
     167        /**/
    159168        //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       
    162172        //RTR
    163173        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 ) );
    165179       
    166180       
     
    168182        CHECK_FCT( fd_disp_register( test_sip_default_cb, DISP_HOW_APPID, &data, &test_sip_default_hdl ) );
    169183       
    170        
     184        /*
    171185        //We start database connection
    172186        if(start_mysql_connection())
    173187                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 ) );
    176192       
    177193        return 0;
     
    181197void fd_ext_fini(void)
    182198{
    183        
     199        /*
    184200        if (test_sip_MAR_cb) {
    185201                (void) fd_disp_unregister(&test_sip_MAR_hdl);
    186202                CHECK_FCT_DO( fd_sess_handler_destroy(&ds_sess_hdl),return);
    187203        }
    188        
     204        */
    189205        //We close database connection
    190         close_mysql_connection();
     206        //close_mysql_connection();
    191207       
    192208
Note: See TracChangeset for help on using the changeset viewer.