示例#1
0
static void handler(void *user_data, v8_result_t *result)
{
    const char *s;
    
    s = (const char *) user_data;
    
    if (result == NULL)
    {
        printf("%s V.8 negotiation failed\n", s);
        return;
    }
    printf("%s V.8 negotiation result:\n", s);
    printf("  Call function '%s'\n", v8_call_function_to_str(result->call_function));
    printf("  Negotiated modulation '%s'\n", v8_modulation_to_str(result->negotiated_modulation));
    printf("  Protocol '%s'\n", v8_protocol_to_str(result->protocol));
    printf("  PSTN access '%s'\n", v8_pstn_access_to_str(result->pstn_access));
    printf("  PCM modem availability '%s'\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability));
    if (result->call_function == V8_CALL_V_SERIES
        &&
        result->negotiated_modulation == V8_MOD_V90
        &&
        result->protocol == V8_PROTOCOL_LAPM_V42)
    {
        negotiations_ok++;
    }
}
示例#2
0
文件: v8_tests.c 项目: vir/spandsp
static void handler(void *user_data, v8_parms_t *result)
{
    const char *s;

    s = (const char *) user_data;

    printf("%s ", s);
    switch (result->status)
    {
    case V8_STATUS_IN_PROGRESS:
        printf("V.8 negotiation in progress\n");
        return;
    case V8_STATUS_V8_OFFERED:
        printf("V.8 offered by the other party\n");
        break;
    case V8_STATUS_V8_CALL:
        printf("V.8 call negotiation successful\n");
        break;
    case V8_STATUS_NON_V8_CALL:
        printf("Non-V.8 call negotiation successful\n");
        break;
    case V8_STATUS_FAILED:
        printf("V.8 call negotiation failed\n");
        return;
    default:
        printf("Unexpected V.8 status %d\n", result->status);
        break;
    }
    /*endswitch*/

    printf("  Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone);
    printf("  Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function);
    printf("  Far end modulations 0x%X\n", result->modulations);
    printf("  Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol);
    printf("  PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access);
    printf("  PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability);
    if (result->t66 >= 0)
        printf("  T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66);
    /*endif*/
    if (result->nsf >= 0)
        printf("  NSF %d\n", result->nsf);
    /*endif*/

    switch (result->status)
    {
    case V8_STATUS_V8_OFFERED:
        /* Edit the result information appropriately */
        //result->call_function = V8_CALL_T30_TX;
        result->modulations &= (V8_MOD_V17
                              | V8_MOD_V21
                              //| V8_MOD_V22
                              //| V8_MOD_V23HDX
                              //| V8_MOD_V23
                              //| V8_MOD_V26BIS
                              //| V8_MOD_V26TER
                              | V8_MOD_V27TER
                              | V8_MOD_V29
                              //| V8_MOD_V32
                              | V8_MOD_V34HDX
                              //| V8_MOD_V34
                              //| V8_MOD_V90
                              | V8_MOD_V92);
        break;
    case V8_STATUS_V8_CALL:
        if (result->call_function == V8_CALL_V_SERIES
            &&
            result->protocol == V8_PROTOCOL_LAPM_V42)
        {
            negotiations_ok++;
        }
        /*endif*/
        break;
    case V8_STATUS_NON_V8_CALL:
        negotiations_ok = 42;
        break;
    }
    /*endswitch*/
}