Ignore:
Timestamp:
Jun 28, 2007 7:15:03 AM (17 years ago)
Author:
bennylp
Message:

Added command to add new account in pjsua application

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r1399 r1400  
    24212421            } else if (menuin[1] == 'a') { 
    24222422 
    2423                 printf("Sorry, this command is not supported yet\n"); 
     2423                char id[80], registrar[80], realm[80], uname[80], passwd[30]; 
     2424                pjsua_acc_config acc_cfg; 
     2425                pj_status_t status; 
     2426 
     2427                if (!simple_input("Your SIP URL:", id, sizeof(id))) 
     2428                    break; 
     2429                if (!simple_input("URL of the registrar:", registrar, sizeof(registrar))) 
     2430                    break; 
     2431                if (!simple_input("Auth Realm:", realm, sizeof(realm))) 
     2432                    break; 
     2433                if (!simple_input("Auth Username:", uname, sizeof(uname))) 
     2434                    break; 
     2435                if (!simple_input("Auth Password:", passwd, sizeof(passwd))) 
     2436                    break; 
     2437 
     2438                pjsua_acc_config_default(&acc_cfg); 
     2439                acc_cfg.id = pj_str(id); 
     2440                acc_cfg.reg_uri = pj_str(registrar); 
     2441                acc_cfg.cred_count = 1; 
     2442                acc_cfg.cred_info[0].scheme = pj_str("digest"); 
     2443                acc_cfg.cred_info[0].realm = pj_str(realm); 
     2444                acc_cfg.cred_info[0].username = pj_str(uname); 
     2445                acc_cfg.cred_info[0].data_type = 0; 
     2446                acc_cfg.cred_info[0].data = pj_str(passwd); 
     2447 
     2448                status = pjsua_acc_add(&acc_cfg, PJ_TRUE, NULL); 
     2449                if (status != PJ_SUCCESS) { 
     2450                    pjsua_perror(THIS_FILE, "Error adding new account", status); 
     2451                } 
    24242452 
    24252453            } else { 
Note: See TracChangeset for help on using the changeset viewer.