Navigation


Changeset 432:533188d2e6cc in freeDiameter


Ignore:
Timestamp:
Jul 28, 2010, 3:14:11 AM (14 years ago)
Author:
Alexandre Westfahl <awestfahl@freediameter.net>
Branch:
default
Phase:
public
Message:

Corrected bugs on SAR/SAA; added SQL files

Files:
5 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • doc/app_sip.conf.sample

    r392 r432  
    11
    22# MODE Diameter-SIP server (DSSERVER) or Subscriber Locator (SL)
     3#You must have at least in your network a Diameter SIP server and a Subscriber Locator (on different nodes)
    34mode = DSSERVER;
    45
     6
     7#******************#
     8#*****DATABASE*****#
     9#******************#
    510# DATASOURCE: MYSQL
    611datasource = MYSQL;
     
    1116mysql_database = "db";
    1217mysql_server = "server.fr";
     18
     19#If value=0, default port for mysql will be set
    1320mysql_port = 0;
     21
     22#Prefix for tables (default is "ds")
     23mysql_prefix = "ds";
  • extensions/app_sip/diamsip.h

    r430 r432  
    9292int get_password(const unsigned char *username, const size_t usernamelen, char *password);
    9393int check_sipaor(const unsigned char  *username, const size_t usernamelen, const char * sip_aor,const size_t sipaorlen);
    94 int get_user_datatype(const unsigned char  *username, const size_t usernamelen,char **table_supported, const int num_elements, struct avp **groupedavp);
     94int add_user_datatype(const unsigned char  *sip_aor, const size_t sipaorlen,struct msg *message);
    9595int set_pending_flag(const unsigned char  *username, const size_t usernamelen);
    9696int clear_pending_flag(const unsigned char  *username, const size_t usernamelen);
     
    101101
    102102//count functions
    103 int count_supporteddatatype(const struct msg * message);
    104 int count_sipaor(const struct msg * message);
     103int count_avp(struct msg * message, int code, int vendor);
    105104
    106105
     
    164163
    165164//sip server uri by SIP-AOR
    166 #define SQL_GETSIPSERURI  "SELECT `sip_server_uri` FROM ds_users, ds_sip_aor WHERE `sip_aor` ='%s' AND `ds_sip_aor`.`id_user` = `ds_users`.`id_user`"
    167 #define SQL_GETSIPSERURI_LEN 119
     165#define SQL_GETSIPSERURI  "SELECT `ds_sip_aor`.`sip_server_uri` FROM ds_users, ds_sip_aor WHERE `sip_aor` ='%s' AND `ds_sip_aor`.`id_user` = `ds_users`.`id_user`"
     166#define SQL_GETSIPSERURI_LEN 132
    168167
    169168//sip capabilities for a SIP-AOR
     
    172171
    173172//user data for a user data supported
    174 #define SQL_GETUSEDATA  "SELECT `data_type`,`data` FROM ds_users, ds_user_data, ds_data_types WHERE `username` ='%s' AND `ds_users`.`id_user` = `ds_user_data`.`id_user` AND `ds_data_types`.`id_data_type`=`ds_user_data`.`id_data_type`"
    175 #define SQL_GETUSEDATA_LEN 206
    176 
    177 #define SQL_GETDIAMURI "SELECT `diameter_uri` FROM sl_sip_aor_map WHERE `sip_aor` ='%s'"
     173#define SQL_GETSIPDATA  "SELECT `label_type`,`data` FROM ds_sip_aor, ds_user_data, ds_data_types WHERE `sip_aor` ='%s' AND `ds_sip_aor`.`id_sip_aor` = `ds_user_data`.`id_sip_aor` AND `ds_data_types`.`id_data_type`=`ds_user_data`.`id_data_type`"
     174#define SQL_GETSIPDATA_LEN 216
     175
     176#define SQL_GETDIAMURI "SELECT `diameter_uri` FROM ds_sip_aor_map WHERE `sip_aor` ='%s'"
    178177#define SQL_GETDIAMURI_LEN 61
    179178
     
    207206extern struct session_handler * ds_sess_hdl;
    208207
    209 
     208//AVP code
     209#define CODE_SIP_USER_DATA_TYPE 388
     210#define CODE_SIP_AOR    122
    210211
    211212struct ds_nonce
  • extensions/app_sip/libdiamsip.c

    r430 r432  
    584584
    585585//We retrieve datatype
    586 int get_user_datatype(const unsigned char  *username, const size_t usernamelen, char **table_supported, const int num_elements, struct avp **groupedavp)
    587 {
    588         CHECK_PARAMS(table_supported && num_elements && username && usernamelen && groupedavp);
    589        
    590        
    591         int counter=0, not_found=1;
     586int add_user_datatype(const unsigned char  *sip_aor, const size_t sipaorlen,struct msg *message)
     587{
     588        CHECK_PARAMS(sip_aor && sipaorlen && message );
     589       
     590        size_t querylen, sipaorpurelen;
     591        char *query, *sipaor_pure;
     592        int not_found=2;
    592593        union avp_value value;
    593594        struct avp *avp, *rootavp;
    594         size_t querylen, usernamepurelen;
    595         char *query, *username_pure;
    596        
    597         if(num_elements<1)
    598                 return 1;
     595        unsigned long *length;
     596       
     597        //a sip aor must begin by "sip:" or "sips:" so it must at least be longer than 4 chars
     598        if(sipaorlen<5)
     599                return 2;
    599600       
    600601        //NOTE: each method has to purify sip_aor itself. You must remove quotes or special chars for security
     
    604605                case ASMYSQL:
    605606                       
    606                         querylen=SQL_GETUSEDATA_LEN + usernamelen;
    607                        
    608                        
    609                         //We allocate the double size of username because at worst it can be all quotes
    610                         username_pure=malloc(usernamelen*2+1);
    611                         //We purify username not to have forbidden characters
    612                         usernamepurelen=mysql_real_escape_string(conn, username_pure, (const char *)username, usernamelen);
    613                        
    614                        
    615                         query = malloc(querylen+usernamelen+ 2);
    616                         snprintf(query, querylen+1, SQL_GETUSEDATA, username_pure);
     607                        querylen=SQL_GETSIPDATA_LEN + sipaorlen;
     608                       
     609                       
     610                        //We allocate the double size of SIP-URI because at worst it can be all quotes
     611                        CHECK_MALLOC(sipaor_pure=malloc(sipaorlen*2+1));
     612                        //We purify SIP-URI not to have forbidden characters
     613                        sipaorpurelen=mysql_real_escape_string(conn, sipaor_pure, (const char *)sip_aor, sipaorlen);
     614                       
     615                       
     616                        query = malloc(querylen+sipaorpurelen+ 2);
     617                        snprintf(query, querylen+1, SQL_GETSIPDATA, sipaor_pure);
    617618                       
    618619                        MYSQL_RES *res;
     
    628629                        }
    629630                        not_found=1;
    630                        
    631                         counter=0;
    632                         unsigned long *length=0;
    633                        
    634                         //int index=0;//current field number
    635                        
    636631                        while ((row = mysql_fetch_row(res)) != NULL)
    637632                        {
    638633                                length=mysql_fetch_lengths(res);
    639634                               
    640                                 for(counter=0;counter<num_elements; counter++)
     635                                if(strlen(row[0])>1)
    641636                                {
    642                                         //TODO: check length
    643                                         if(strcmp(table_supported[counter],row[0]))
    644                                         {
    645                                                 CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data, 0, &rootavp ) );
    646                                                
    647                                                 CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data_Type, 0, &avp ) );
    648                                                 value.os.data=(unsigned char *)table_supported[counter];
    649                                                 value.os.len=strlen(table_supported[counter]);
    650                                                 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
    651                                                 CHECK_FCT( fd_msg_avp_add ( rootavp, MSG_BRW_LAST_CHILD, avp) );
    652                                                 //This was used
    653                                                 table_supported[counter]=NULL;
    654                                                
    655                                                 CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data_Contents, 0, &avp ) );
    656                                                 CHECK_MALLOC(value.os.data=malloc((length[1])*sizeof(unsigned char)));
    657                                                 memcpy(value.os.data,row[1],length[1]);
    658                                                 value.os.len=(size_t)(length[1]*sizeof(unsigned char));
    659                                                 CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
    660                                                 CHECK_FCT( fd_msg_avp_add ( rootavp, MSG_BRW_LAST_CHILD, avp) );
    661                                                
    662                                                 CHECK_FCT( fd_msg_avp_add ( *groupedavp, MSG_BRW_LAST_CHILD, rootavp) );
    663                                                 not_found=0;
    664                                         }
     637                                        CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data, 0, &rootavp ) );
     638                                       
     639                                        CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data_Type, 0, &avp ) );
     640                                        CHECK_MALLOC(value.os.data=malloc(length[0]*sizeof(unsigned char)));
     641                                        strncpy((char *)value.os.data,(char *)row[0],length[0]);
     642                                        value.os.len=(size_t)length[0];
     643                                        CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
     644                                        CHECK_FCT( fd_msg_avp_add ( rootavp, MSG_BRW_LAST_CHILD, avp) );
     645                                       
     646                                       
     647                                       
     648                                        CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_User_Data_Contents, 0, &avp ) );
     649                                        CHECK_MALLOC(value.os.data=malloc(length[1]*sizeof(unsigned char)));
     650                                        memcpy(value.os.data,row[1],length[1]);
     651                                        value.os.len=(size_t)length[1];
     652                                        CHECK_FCT( fd_msg_avp_setvalue ( avp, &value ) );
     653                                        CHECK_FCT( fd_msg_avp_add ( rootavp, MSG_BRW_LAST_CHILD, avp) );
     654                                       
     655                                        //We add SIP_User_Data to message
     656                                        CHECK_FCT( fd_msg_avp_add ( message, MSG_BRW_LAST_CHILD, rootavp) );
     657                                        not_found=0;
    665658                                }
    666                                 //index++;
     659                               
    667660                        }
    668661                       
    669662                        mysql_free_result(res);
    670663                        free(query);
    671                         free(username_pure);
     664                        free(sipaor_pure);
    672665                        break;
    673666                       
     
    683676        //0 if it was found
    684677        return not_found;
     678       
     679       
    685680       
    686681}
     
    952947}
    953948
    954 int count_sipaor(const struct msg * message)
     949
     950int count_avp(struct msg * message, int code, int vendor)
    955951{
    956952        CHECK_PARAMS(message);
     
    960956        int counter=0;
    961957       
    962         CHECK_FCT(fd_msg_browse ( &message, MSG_BRW_WALK, &avp, NULL));
     958        CHECK_FCT(fd_msg_browse (message, MSG_BRW_WALK, &avp, NULL));
    963959       
    964960        while(avp!=NULL)
     
    967963                CHECK_FCT( fd_msg_avp_hdr( avp,&temphdr ));
    968964               
    969                 if(temphdr->avp_code==122 && temphdr->avp_vendor==0)
     965                if(temphdr->avp_code==code && temphdr->avp_vendor==vendor)
    970966                {
    971967                        counter++;
    972968                }
    973969               
    974                 CHECK_FCT(fd_msg_browse ( &message, MSG_BRW_WALK, &avp, NULL));
    975         }
    976         return counter;
    977 }
    978 int count_supporteddatatype(const struct msg * message)
    979 {
    980         CHECK_PARAMS(message);
    981        
    982         struct avp_hdr *temphdr;
    983         struct avp *avp;
    984         int counter=0;
    985        
    986         CHECK_FCT(fd_msg_browse ( &message, MSG_BRW_WALK, &avp, NULL));
    987        
    988         while(avp!=NULL)
    989         {
    990                
    991                 CHECK_FCT( fd_msg_avp_hdr( avp,&temphdr ));
    992                
    993                 if(temphdr->avp_code==388 && temphdr->avp_vendor==0)
    994                 {
    995                         counter++;
    996                 }
    997                
    998                 CHECK_FCT(fd_msg_browse ( &message, MSG_BRW_WALK, &avp, NULL));
     970                CHECK_FCT(fd_msg_browse (avp, MSG_BRW_WALK, &avp, NULL));
    999971        }
    1000972        return counter;
  • extensions/app_sip/serverassignment.c

    r430 r432  
    4242       
    4343        struct msg *ans, *qry;
    44         struct avp *avp, *groupedavp=NULL;
     44        struct avp *avp;
    4545        struct avp_hdr *avphdr, *sipaorhdr, *usernamehdr, *sipuserdataalreadyavailable;
    4646        union avp_value value;
    47         int ret=0, assignment_type=0, supported_datatype=0, got_datatype=0;
     47        int ret=0, assignment_type=0, got_datatype=1;
    4848       
    4949       
     
    176176        }
    177177       
    178         //TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO : check which assignment need data type
    179         //We check if we have SIP_Supported_User_Data_Type and we make a table with all of them
    180         {
    181                 supported_datatype=count_supporteddatatype(qry);
    182                
    183                 if(supported_datatype>0)
    184                 {
    185                         char ** table_supporteddatatype=NULL;
    186                        
    187                         //TODO: maybe table doesn't work'
    188                         //We make a table of char * to store all supported datatypes
    189                         CHECK_MALLOC(table_supporteddatatype=(char**)realloc(table_supporteddatatype,supported_datatype*sizeof(char *)));
    190                        
    191                        
    192                         CHECK_FCT(fd_msg_browse ( qry, MSG_BRW_WALK, &avp, NULL));
    193                         int counter=0;
    194                        
    195                         while(avp!=NULL)
    196                         {
    197                                
    198                                 CHECK_FCT( fd_msg_avp_hdr( avp,&avphdr ));
    199                                
    200                                 //TODO: check if counter is good!
    201                                 if(avphdr->avp_code==388 && avphdr->avp_vendor==0 && counter<supported_datatype)
    202                                 {
    203                                        
    204                                         CHECK_MALLOC(table_supporteddatatype[counter]=malloc(avphdr->avp_value->os.len+1));
    205                                         strncpy(table_supporteddatatype[counter],(const char *)avphdr->avp_value->os.data,avphdr->avp_value->os.len);
    206                                         table_supporteddatatype[counter][avphdr->avp_value->os.len+1]='\0';
    207                                        
    208                                         counter++;
    209                                 }
    210                                
    211                                 CHECK_FCT(fd_msg_browse ( qry, MSG_BRW_WALK, &avp, NULL));
    212                         }
    213                        
    214                         if(usernamehdr!=NULL)
    215                         {
    216                                 ret=get_user_datatype(usernamehdr->avp_value->os.data, usernamehdr->avp_value->os.len,(char **)table_supporteddatatype, counter, &groupedavp);
    217                                
    218                                 //We free all unused datatypes
    219                                 int i=0;
    220                                 for(i=0;i<counter;i++)
    221                                 {
    222                                         if(table_supporteddatatype[counter]!=NULL)
    223                                                 free(table_supporteddatatype[counter]);
    224                                 }
    225                                
    226                                 if(ret==0)
    227                                 {
    228                                         got_datatype=1;
    229                                        
    230                                 }
    231                                 else if(ret==1)
    232                                 {
    233                                         TRACE_DEBUG(INFO,"There was no link between supported and transmisted SIP-User-Data AVPs");
    234                                 }
    235                                 else
    236                                 {
    237                                         strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
    238                                         goto out;
    239                                 }
    240                                
    241                         }
    242                         else
    243                         {
    244                                 strcpy(result,"DIAMETER_USER_NAME_REQUIRED");
    245                                 int i=0;
    246                                 for(i=0;i<counter;i++)
    247                                 {
    248                                         if(table_supporteddatatype[counter]!=NULL)
    249                                                 free(table_supporteddatatype[counter]);
    250                                 }
    251                                 goto out;
    252                         }
    253                        
    254                 }
    255         }
     178       
     179       
     180       
    256181       
    257182        //We get SIP_User_Data_Already_Available AVP
     
    263188        if(assignment_type==1 || assignment_type==2)
    264189        {//registration & re-registration
    265                 if(count_sipaor(qry)==1)
     190                if(count_avp(qry,CODE_SIP_AOR,0)==1)
     191                {
     192                       
     193                        if(sipuserdataalreadyavailable->avp_value->i32==0)
     194                        {//Data not available, we must provide it
     195                                ret=add_user_datatype(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len,ans);
     196                               
     197                                if(ret==0)
     198                                {
     199                                        //We found and added datatype
     200                                        got_datatype=1;
     201                                }
     202                                else if(ret==1)
     203                                {
     204                                        //No data type was found
     205                                        got_datatype=0;
     206                                }
     207                                else
     208                                {//error
     209                                //We couldn't make the request, we must stop process!
     210                                strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     211                                goto out;
     212                                }
     213                        }
     214                        strcpy(result,"DIAMETER_SUCCESS");
     215                        goto out;
     216                }
     217                else
     218                {//There is more than 1 SIP-AOR AVP
     219                        strcpy(result,"DIAMETER_AVP_OCCURS_TOO_MANY_TIMES");
     220                        goto out;
     221                }
     222        }
     223        else if(assignment_type==3)
     224        {//Unregistered user
     225               
     226                //TODO:place user unknown here!
     227                if(count_avp(qry,CODE_SIP_AOR,0)==1)
    266228                {
    267229                        if(sipuserdataalreadyavailable->avp_value->i32==0)
     
    269231                                if(got_datatype==1)
    270232                                {
    271                                         //We provide User Data
    272                                         CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, groupedavp) );
    273                                 }
    274                         }
    275                         strcpy(result,"DIAMETER_SUCCESS");
    276                         goto out;
    277                 }
    278                 else
    279                 {//There is more than 1 SIP-AOR AVP
    280                         strcpy(result,"DIAMETER_AVP_OCCURS_TOO_MANY_TIMES");
    281                         goto out;
    282                 }
    283         }
    284         else if(assignment_type==3)
    285         {//Unregistered user
    286                
    287                 //TODO:place user unknown here!
    288                 if(count_sipaor(qry)==1)
    289                 {
    290                         if(sipuserdataalreadyavailable->avp_value->i32==0)
    291                         {//Data not available, we must provide it
    292                                 if(got_datatype==1)
    293                                 {
    294                                         //We provide User Data
    295                                         CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, groupedavp) );
     233                                        ret=add_user_datatype(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len,ans);
     234                                       
     235                                        if(ret==0)
     236                                        {
     237                                                //We found and added datatype
     238                                                got_datatype=1;
     239                                        }
     240                                        else if(ret==1)
     241                                        {
     242                                                //No data type was found
     243                                                got_datatype=0;
     244                                        }
     245                                        else
     246                                        {//error
     247                                                //We couldn't make the request, we must stop process!
     248                                                strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     249                                                goto out;
     250                                        }
    296251                                }
    297252                        }
     
    309264                        if(got_datatype==1)
    310265                        {
    311                                 //We provide User Data
    312                                 CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, groupedavp) );
     266                                ret=add_user_datatype(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len,ans);
     267                               
     268                                if(ret==0)
     269                                {
     270                                        //We found and added datatype
     271                                        got_datatype=1;
     272                                }
     273                                else if(ret==1)
     274                                {
     275                                        //No data type was found
     276                                        got_datatype=0;
     277                                }
     278                                else
     279                                {//error
     280                                        //We couldn't make the request, we must stop process!
     281                                        strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     282                                        goto out;
     283                                }
    313284                        }
    314285                }
     
    338309                        {//Data not available, we must provide it
    339310                               
    340                                 //We provide User Data
    341                                 CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, groupedavp) );
    342                         }
    343                         else
    344                         {
    345                                 CHECK_FCT( fd_msg_free( groupedavp ) );
     311                                ret=add_user_datatype(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len,ans);
     312                               
     313                                if(ret==0)
     314                                {
     315                                        //We found and added datatype
     316                                        got_datatype=1;
     317                                }
     318                                else if(ret==1)
     319                                {
     320                                        //No data type was found
     321                                        got_datatype=0;
     322                                }
     323                                else
     324                                {//error
     325                                        //We couldn't make the request, we must stop process!
     326                                        strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     327                                        goto out;
     328                                }
    346329                        }
    347330                }
     
    399382                if(avp!=NULL)
    400383                {
    401                         //TODO: check that SIP-server_URI provided is the same as associated and answer unable to comply if so
    402                         //TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO here
    403                        
    404                        
    405                         CHECK_FCT( fd_msg_avp_hdr( avp, &avphdr ));
    406                        
    407                         if(got_datatype==1)
     384                        unsigned char * sipserver_uri;
     385                        size_t sipserverurilen;
     386                       
     387                       
     388                       
     389                       
     390                        ret=get_sipserver_uri(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len, &sipserver_uri, &sipserverurilen);
     391                       
     392                        if(ret==0)
     393                        {//found
     394                                CHECK_FCT( fd_msg_avp_hdr( avp, &avphdr ));
     395                               
     396                               
     397                               
     398                               
     399                                if(strncmp((char *)avphdr->avp_value->os.data,(char *)sipserver_uri,sipserverurilen))
     400                                {
     401                                        if(got_datatype==1)
     402                                        {
     403                                                if(sipuserdataalreadyavailable->avp_value->i32==0)
     404                                                {//Data not available, we must provide it
     405                                                       
     406                                                        ret=add_user_datatype(sipaorhdr->avp_value->os.data, sipaorhdr->avp_value->os.len,ans);
     407                                                       
     408                                                        if(ret==0)
     409                                                        {
     410                                                                //We found and added datatype
     411                                                                got_datatype=1;
     412                                                        }
     413                                                        else if(ret==1)
     414                                                        {
     415                                                                //No data type was found
     416                                                                got_datatype=0;
     417                                                        }
     418                                                        else
     419                                                        {//error
     420                                                                //We couldn't make the request, we must stop process!
     421                                                                strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     422                                                                goto out;
     423                                                        }
     424                                                }
     425                                        }
     426                                }
     427                                else
     428                                {//error
     429                                        TRACE_DEBUG(FULL,"SIP_Server_URI is different from the one in database");
     430                                        strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     431                                        goto out;
     432                                }
     433                        }
     434                        else
    408435                        {
    409                                 if(sipuserdataalreadyavailable->avp_value->i32==0)
    410                                 {//Data not available, we must provide it
    411                                        
    412                                         //We provide User Data
    413                                         CHECK_FCT( fd_msg_avp_add ( ans, MSG_BRW_LAST_CHILD, groupedavp) );
    414                                 }
    415                                 else
    416                                 {
    417                                         CHECK_FCT( fd_msg_free( groupedavp ) );
    418                                 }
    419                         }
     436                                TRACE_DEBUG(FULL,"SIP_Server_URI is different from the one in database");
     437                                strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
     438                                goto out;
     439                        }
     440                       
     441                       
     442                       
    420443                       
    421444                       
     
    428451                else
    429452                {
    430                         TRACE_DEBUG(INFO, "There was no SIP-AOR in this request, we can't proceed request!'");
     453                        TRACE_DEBUG(INFO, "There was no SIP_Server_URI in this request, we can't proceed request!'");
    431454                        strcpy(result,"DIAMETER_UNABLE_TO_COMPLY");
    432455                        goto out;
     
    435458        else if(assignment_type==9 || assignment_type==10)
    436459        {
    437                 if(count_sipaor(qry)==1)
     460                if(count_avp(qry, CODE_SIP_AOR,0)==1)
    438461                {
    439462                        //TODO: remove SIP-server URI for sip_aor
  • extensions/test_sip/serverassignment.c

    r430 r432  
    4646       
    4747        //Fake values START
    48          char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
     48        char *sip_aor="sip:aw-lappy@tera.ics.keio.ac.jp";
    4949        size_t aor_len=strlen(sip_aor);
    50          char *destination_realm="tera.ics.keio.ac.jp";
     50        char *destination_realm="tera.ics.keio.ac.jp";
    5151        size_t destination_realmlen=strlen(destination_realm);
    52          char *destination_host="suika.tera.ics.keio.ac.jp";
     52        char *destination_host="suika.tera.ics.keio.ac.jp";
    5353        size_t destination_hostlen=strlen(destination_host);
    54          char *username="aw-lappy";
     54        char *username="aw-lappy";
    5555        size_t usernamelen=strlen(username);
     56        char *sipserveruri="sip:ichigo@tera.ics.keio.ac.jp";
     57        size_t sipserverurilen=strlen(sipserveruri);
    5658        // char *visitednetwork="Pink";
    5759        //size_t visitednetworklen=strlen(visitednetwork);
     
    149151                CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
    150152        }
     153        //SIP_server_uri
     154        {
     155               
     156                CHECK_FCT( fd_msg_avp_new ( sip_dict.SIP_Server_URI, 0, &avp ) );
     157                value.os.data=(unsigned char *)sipserveruri;
     158                value.os.len=sipserverurilen;
     159                CHECK_FCT( fd_msg_avp_setvalue( avp, &value ) );
     160                CHECK_FCT( fd_msg_avp_add( message, MSG_BRW_LAST_CHILD, avp ) );
     161               
     162        }
    151163       
    152164        fd_msg_dump_walk(INFO,message);
Note: See TracChangeset for help on using the changeset viewer.