Hi all, I write a little ivr server and I hope that I can handle a maximum account of calls. All is working well is I have a low account of calls (less than 5). Now I tried it with 20 calls, and the applications stops playing. Looking in the code, I can see that the thread is locked in conference.c in the pjmedia_conf_add_port method. (pj_mutex_lock(conf->mutex);) With some printfs, I checked that the account of "unlocks" is equal to the account of "locks", it seems to be correct. Has onyone tried to handle that account of calls ? (Sorry for my bad english) Here is my code if that can help : Regards, Frederic //--------------------------------------------------------------------- void TSvi::SVI_Init() //--------------------------------------------------------------------- { pj_status_t status; pjsua_config cfg; pjsua_logging_config log_cfg; pjsua_transport_config transport_cfg; pjsua_transport_id tid; pjsua_media_config media_cfg; status = pjsua_create(); if (status != PJ_SUCCESS) this->Exit("Erreur dans pjsua_create !\n"); pjsua_config_default(&cfg); cfg.max_calls=30; cfg.cb.on_incoming_call = &on_incoming_call; cfg.cb.on_call_media_state = &on_call_media_state; cfg.cb.on_call_state = &on_call_state; cfg.cb.on_call_tsx_state = &on_call_tsx_state; cfg.cb.on_dtmf_digit = &call_on_dtmf_callback; pjsua_logging_config_default(&log_cfg); log_cfg.console_level = 100; pjsua_media_config_default(&media_cfg); pjsua_transport_config_default(&transport_cfg); transport_cfg.port = 5060; status = pjsua_transport_create(PJSIP_TRANSPORT_UDP, &transport_cfg, &tid); if (status != PJ_SUCCESS) this->Exit("Erreur dans pjsua_transport_create\n"); pjsua_acc_add_local (tid, false, &p_acc_id); status = pjsua_init(&cfg, &log_cfg, &media_cfg); if (status != PJ_SUCCESS) this->Exit("Erreur dans pjsua_init"); status = pjsua_start(); if (status != PJ_SUCCESS) this->Exit("Erreur dans pjsua_start"); } //------------------------------------------------------------- // Called when a message is received by my application server void TSvi::HandleStartPlayMsg(TApplication *App) //------------------------------------------------------------- { char FileName[256]; int CallId; pj_str_t wav_files[32]; pj_status_t status; pjsua_player_id player_id; pjmedia_port *media_port; wavplayerEof_Data *args; TCall *Call; pj_str_t pjstr; CallId = atoi(App->GetItemList()->GetItemValue("CallId")); strcpy(FileName, App->GetItemList()->GetItemValue("FileName")); pjstr.ptr = FileName; pjstr.slen = strlen(FileName); printf("%s\n", FileName); wav_files[0]=pj_str(FileName); printf("Avant Player_Create\n"); status = pjsua_player_create(&pjstr, PJMEDIA_FILE_NO_LOOP, &player_id); printf("Apr?s Player_Create\n"); if (status != PJ_SUCCESS) { _Logger->Log(LOG_ERROR, "Erreur dans pjsua_player_create\n"); return; } status = pjsua_player_get_port(player_id, &media_port); args = (wavplayerEof_Data*)malloc(sizeof(wavplayerEof_Data)); args->playerId = player_id; args->callId = CallId; args->Application = App; status = pjmedia_wav_player_set_eof_cb(media_port, args, &on_wavplayerEof_callback); status = pjsua_conf_connect( pjsua_player_get_conf_port(player_id), pjsua_call_get_conf_port(CallId) ); _Logger->Log(LOG_INFO, "START_PLAY %s on channel %d\n", FileName, CallId); Call = this->CallList->GetById(CallId); if (!Call) { _Logger->Log(LOG_ERROR, "HandleStartPlayMsg : unable to get call [%d]\n", CallId); return; } Call->SetState(CALL_STA_PLAYING); Call->SetAcceptedDigits(App->GetItemList()->GetItemValue("AcceptedDigits")); Call->SetMaxDigits(atoi(App->GetItemList()->GetItemValue("MaxDigits"))); Call->SetTerminationDigits(App->GetItemList()->GetItemValue("TerminationDigits")); Call->SetPlayerId(player_id); Call->ClearDtmfs(); } //--------------------------------------------------------------------- // Call by the change_state callback void TSvi::SVI_PlayFinished(pjsua_call_id call_id) //--------------------------------------------------------------------- { char Msg[256]; TCall *Call; Call = this->CallList->GetById(call_id); if (!Call) { _Logger->Log(LOG_ERROR, "DtmfReceived : unable to find call (%d)\n", call_id); return; } sprintf(Msg, "CallId=%d\nReason=%d\nDtmfs=%s\n", call_id, REASON_EOF, Call->GetDtmfs()); Call->GetApplication()->Send("END_PLAY", Msg); Call->SetState(CALL_STA_IDLE); pjsua_player_destroy(Call->GetPlayerId()); _Logger->Log("END_PLAY call %d\n", call_id); } -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080903/9fa86db0/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: fclement.vcf Type: text/x-vcard Size: 389 bytes Desc: not available Url : http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080903/9fa86db0/attachment.vcf