Index: res/res_pjsip.c =================================================================== --- res/res_pjsip.c (revision 411632) +++ res/res_pjsip.c (working copy) @@ -1398,6 +1398,7 @@ if (ast_strlen_zero(user)) { RAII_VAR(struct ast_uuid *, uuid, ast_uuid_generate(), ast_free_ptr); if (!uuid) { + ast_log(LOG_NOTICE, "Failed to create UUID\n"); return -1; } user = ast_uuid_to_str(uuid, uuid_str, sizeof(uuid_str)); @@ -1408,6 +1409,7 @@ if (!(uri = pjsip_parse_uri(pool, tmp.ptr, tmp.slen, 0)) || (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri))) { + ast_log(LOG_NOTICE, "URI Parsing failure or URI scheme isn't SIP or SIPS\n"); return -1; } @@ -1423,6 +1425,7 @@ } if (type == PJSIP_TRANSPORT_UNSPECIFIED) { + ast_log(LOG_NOTICE, "Unspecified transport? This be problem\n"); return -1; } @@ -1516,15 +1519,18 @@ pj_cstr(&target_uri, uri); if (pjsip_dlg_create_uac(pjsip_ua_instance(), &local_uri, NULL, &remote_uri, &target_uri, &dlg) != PJ_SUCCESS) { + ast_log(LOG_NOTICE, "Okay, it really is PJSIP that has the dialog creationg problem.\n"); return NULL; } if (sip_get_tpselector_from_endpoint(endpoint, &selector)) { + ast_log(LOG_NOTICE, "Failed to get transport selector for this endpoint\n"); pjsip_dlg_terminate(dlg); return NULL; } if (sip_dialog_create_from(dlg->pool, &local_uri, endpoint->fromuser, endpoint->fromdomain, &remote_uri, &selector)) { + ast_log(LOG_NOTICE, "Failed to reate From header\n"); pjsip_dlg_terminate(dlg); return NULL; } @@ -1564,6 +1570,7 @@ if (!(route = pjsip_parse_hdr(dlg->pool, &ROUTE_HNAME, tmp.ptr, tmp.slen, NULL))) { dlg->sess_count--; pjsip_dlg_terminate(dlg); + ast_log(LOG_NOTICE, "Failed to parse Route headers\n"); return NULL; } pj_list_insert_nodes_before(&route_set, route); Index: res/res_pjsip_session.c =================================================================== --- res/res_pjsip_session.c (revision 411632) +++ res/res_pjsip_session.c (working copy) @@ -1206,33 +1206,46 @@ /* If no location has been provided use the AOR list from the endpoint itself */ if (location || !contact) { + ast_log(LOG_NOTICE, "Using AOR list from endpoint as basis for location\n"); location = S_OR(location, endpoint->aors); found_contact = ast_sip_location_retrieve_contact_from_aor_list(location); if (!found_contact || ast_strlen_zero(found_contact->uri)) { + ast_log(LOG_NOTICE, "Uh oh, we either didn't find a contact for %s or the contact has no URI?\n", + location); + if (!found_contact) { + ast_log(LOG_NOTICE, "Ah, no contact\n"); + } else { + ast_log(LOG_NOTICE, "Ah, contact had no URI\n"); + } uri = location; } else { uri = found_contact->uri; } } else { + ast_log(LOG_NOTICE, "Using passed-in contact as basis for location\n"); uri = contact->uri; } /* If we still have no URI to dial fail to create the session */ if (ast_strlen_zero(uri)) { + ast_log(LOG_NOTICE, "After all that looking up, we didn't get a URI :(\n"); return NULL; } if (!(dlg = ast_sip_create_dialog_uac(endpoint, uri, request_user))) { + ast_log(LOG_NOTICE, "Error creating SIP dialog\n"); return NULL; } if (ast_sip_dialog_setup_outbound_authentication(dlg, endpoint, session_outbound_auth, NULL)) { pjsip_dlg_terminate(dlg); + ast_log(LOG_NOTICE, "Errro setting up outbound authentication (surely not...)\n"); return NULL; } if (pjsip_inv_create_uac(dlg, NULL, endpoint->extensions.flags, &inv_session) != PJ_SUCCESS) { + ast_log(LOG_NOTICE, "Error setting up PJSIP inv_session\n"); pjsip_dlg_terminate(dlg); return NULL; } @@ -1247,6 +1260,7 @@ if (!(session = ast_sip_session_alloc(endpoint, found_contact ? found_contact : contact, inv_session))) { pjsip_inv_terminate(inv_session, 500, PJ_FALSE); + ast_log(LOG_NOTICE, "Session allocation failed\n"); return NULL; } @@ -1256,6 +1270,7 @@ } if ((pjsip_dlg_add_usage(dlg, &session_module, NULL) != PJ_SUCCESS)) { + ast_log(LOG_NOTICE, "Failed to add dialog usage (surely not...)\n"); pjsip_inv_terminate(inv_session, 500, PJ_FALSE); /* Since we are not notifying ourselves that the INVITE session is being terminated * we need to manually drop its reference to session