Changeset 728
Update libpri with latest changes.
Comitted by:
brian
Date:
Oct 28 2005 * 20:59 (over 6 years ago)
Affected files:
libpri/trunk/Makefile.in
libpri/trunk/libpri.h (diff)
libpri/trunk/pri.c (diff)
libpri/trunk/pri_internal.h (diff)
libpri/trunk/q931.c (diff)
libpri/trunk/libpri.h (unified diff)
| r196 | r728 | |
|---|---|---|
| 274 | 274 | int progress; |
| 275 | 275 | int progressmask; |
| 276 | 276 | q931_call *call; |
| 277 | char useruserinfo[260]; /* User->User info */ | |
| 277 | 278 | } pri_event_ringing; |
| 278 | 279 | |
| 279 | 280 | typedef struct pri_event_answer { |
| --- | --- | |
| 283 | 284 | int progress; |
| 284 | 285 | int progressmask; |
| 285 | 286 | q931_call *call; |
| 287 | char useruserinfo[260]; /* User->User info */ | |
| 286 | 288 | } pri_event_answer; |
| 287 | 289 | |
| 288 | 290 | typedef struct pri_event_facname { |
| --- | --- | |
| 312 | 314 | char redirectingname[256]; /* Redirecting name */ |
| 313 | 315 | int redirectingreason; /* Reason for redirect */ |
| 314 | 316 | int callingplanrdnis; /* Dialing plan of Redirecting Number */ |
| 315 | char useruserinfo[256]; /* User->User info */ | |
| 317 | char useruserinfo[260]; /* User->User info */ | |
| 316 | 318 | int flexible; /* Are we flexible with our channel selection? */ |
| 317 | 319 | int cref; /* Call Reference Number */ |
| 318 | 320 | int ctype; /* Call type (see PRI_TRANS_CAP_* */ |
| --- | --- | |
| 335 | 337 | int cref; |
| 336 | 338 | q931_call *call; /* Opaque call pointer */ |
| 337 | 339 | long aoc_units; /* Advise of Charge number of charged units */ |
| 340 | char useruserinfo[260]; /* User->User info */ | |
| 338 | 341 | } pri_event_hangup; |
| 339 | 342 | |
| 340 | 343 | typedef struct pri_event_restart_ack { |
| --- | --- | |
| 519 | 522 | extern int pri_sr_set_called(struct pri_sr *sr, char *called, int calledplan, int complete); |
| 520 | 523 | extern int pri_sr_set_caller(struct pri_sr *sr, char *caller, char *callername, int callerplan, int callerpres); |
| 521 | 524 | extern int pri_sr_set_redirecting(struct pri_sr *sr, char *num, int plan, int pres, int reason); |
| 525 | #define PRI_USER_USER_TX | |
| 526 | /* Set the user user field. Warning! don't send binary data accross this field */ | |
| 527 | extern void pri_sr_set_useruser(struct pri_sr *sr, char *userchars); | |
| 522 | 528 | |
| 529 | extern void pri_call_set_useruser(q931_call *sr, char *userchars); | |
| 530 | ||
| 523 | 531 | extern int pri_setup(struct pri *pri, q931_call *call, struct pri_sr *req); |
| 524 | 532 | |
| 525 | 533 | /* Set a call has a call indpendent signalling connection (i.e. no bchan) */ |
libpri/trunk/pri.c (unified diff)
| r196 | r728 | |
|---|---|---|
| 247 | 247 | return p; |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | void pri_call_set_useruser(q931_call *c, char *userchars) | |
| 251 | { | |
| 252 | if (userchars) | |
| 253 | libpri_copy_string(c->useruserinfo, userchars, sizeof(c->useruserinfo)); | |
| 254 | } | |
| 255 | ||
| 256 | void pri_sr_set_useruser(struct pri_sr *sr, char *userchars) | |
| 257 | { | |
| 258 | sr->useruserinfo = userchars; | |
| 259 | } | |
| 260 | ||
| 250 | 261 | int pri_restart(struct pri *pri) |
| 251 | 262 | { |
| 252 | 263 | /* Restart Q.921 layer */ |
libpri/trunk/pri_internal.h (unified diff)
| r196 | r728 | |
|---|---|---|
| 129 | 129 | int redirectingpres; |
| 130 | 130 | int redirectingreason; |
| 131 | 131 | int justsignalling; |
| 132 | char *useruserinfo; | |
| 132 | 133 | }; |
| 133 | 134 | |
| 134 | 135 | /* Internal switch types */ |
libpri/trunk/q931.c (unified diff)
| r196 | r728 | |
|---|---|---|
| 969 | 969 | return 0; |
| 970 | 970 | } |
| 971 | 971 | |
| 972 | static FUNC_SEND(transmit_user_user) | |
| 973 | { | |
| 974 | int datalen = strlen(call->useruserinfo); | |
| 975 | if (datalen > 0) { | |
| 976 | /* Restricted to 35 characters */ | |
| 977 | if (msgtype == Q931_USER_INFORMATION) { | |
| 978 | if (datalen > 260) | |
| 979 | datalen = 260; | |
| 980 | } else { | |
| 981 | if (datalen > 35) | |
| 982 | datalen = 35; | |
| 983 | } | |
| 984 | ie->data[0] = 4; /* IA5 characters */ | |
| 985 | memcpy(&ie->data[1], call->useruserinfo, datalen); | |
| 986 | call->useruserinfo[0] = '\0'; | |
| 987 | return datalen + 3; | |
| 988 | } | |
| 989 | ||
| 990 | return 0; | |
| 991 | } | |
| 992 | ||
| 972 | 993 | static char *prog2str(int prog) |
| 973 | 994 | { |
| 974 | 995 | static struct msgtype progs[] = { |
| --- | --- | |
| 1927 | 1948 | { 1, Q931_IE_KEYPAD_FACILITY, "Keypad Facility", dump_keypad_facility, receive_keypad_facility }, |
| 1928 | 1949 | { 0, Q931_IE_SIGNAL, "Signal", dump_signal }, |
| 1929 | 1950 | { 1, Q931_IE_SWITCHHOOK, "Switch-hook" }, |
| 1930 | { 1, Q931_IE_USER_USER, "User-User", dump_user_user, receive_user_user }, | |
| 1951 | { 1, Q931_IE_USER_USER, "User-User", dump_user_user, receive_user_user, transmit_user_user }, | |
| 1931 | 1952 | { 1, Q931_IE_ESCAPE_FOR_EXT, "Escape for Extension" }, |
| 1932 | 1953 | { 1, Q931_IE_CALL_STATUS, "Call Status" }, |
| 1933 | 1954 | { 1, Q931_IE_CHANGE_STATUS, "Change Status" }, |
| --- | --- | |
| 2504 | 2525 | return send_message(pri, c, Q931_CALL_PROCEEDING, call_proceeding_ies); |
| 2505 | 2526 | } |
| 2506 | 2527 | #ifndef ALERTING_NO_PROGRESS |
| 2507 | static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, -1 }; | |
| 2528 | static int alerting_ies[] = { Q931_PROGRESS_INDICATOR, Q931_IE_USER_USER, -1 }; | |
| 2508 | 2529 | #else |
| 2509 | 2530 | static int alerting_ies[] = { -1 }; |
| 2510 | 2531 | #endif |
| --- | --- | |
| 2627 | 2648 | return send_message(pri, c, Q931_CONNECT, connect_ies); |
| 2628 | 2649 | } |
| 2629 | 2650 | |
| 2630 | static int release_ies[] = { Q931_CAUSE, -1 }; | |
| 2651 | static int release_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 }; | |
| 2631 | 2652 | |
| 2632 | 2653 | int q931_release(struct pri *pri, q931_call *c, int cause) |
| 2633 | 2654 | { |
| --- | --- | |
| 2675 | 2696 | return send_message(pri, c, Q931_RESTART, restart_ies); |
| 2676 | 2697 | } |
| 2677 | 2698 | |
| 2678 | static int disconnect_ies[] = { Q931_CAUSE, -1 }; | |
| 2699 | static int disconnect_ies[] = { Q931_CAUSE, Q931_IE_USER_USER, -1 }; | |
| 2679 | 2700 | |
| 2680 | 2701 | int q931_disconnect(struct pri *pri, q931_call *c, int cause) |
| 2681 | 2702 | { |
| --- | --- | |
| 2695 | 2716 | return 0; |
| 2696 | 2717 | } |
| 2697 | 2718 | |
| 2698 | static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, | |
| 2719 | static int setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, Q931_IE_FACILITY, Q931_PROGRESS_INDICATOR, Q931_NETWORK_SPEC_FAC, Q931_DISPLAY, Q931_IE_USER_USER, | |
| 2699 | 2720 | Q931_CALLING_PARTY_NUMBER, Q931_CALLED_PARTY_NUMBER, Q931_REDIRECTING_NUMBER, Q931_SENDING_COMPLETE, Q931_IE_ORIGINATING_LINE_INFO, Q931_IE_GENERIC_DIGITS, -1 }; |
| 2700 | 2721 | |
| 2701 | 2722 | static int gr303_setup_ies[] = { Q931_BEARER_CAPABILITY, Q931_CHANNEL_IDENT, -1 }; |
| --- | --- | |
| 2773 | 2794 | } else |
| 2774 | 2795 | return -1; |
| 2775 | 2796 | |
| 2797 | if (req->useruserinfo) | |
| 2798 | libpri_copy_string(c->useruserinfo, req->useruserinfo, sizeof(c->useruserinfo)); | |
| 2799 | ||
| 2776 | 2800 | if (req->nonisdn && (pri->switchtype == PRI_SWITCH_NI2)) |
| 2777 | 2801 | c->progressmask = PRI_PROG_CALLER_NOT_ISDN; |
| 2778 | 2802 | else |
| --- | --- | |
| 2797 | 2821 | |
| 2798 | 2822 | } |
| 2799 | 2823 | |
| 2800 | static int release_complete_ies[] = { -1 }; | |
| 2824 | static int release_complete_ies[] = { Q931_IE_USER_USER, -1 }; | |
| 2801 | 2825 | |
| 2802 | 2826 | static int q931_release_complete(struct pri *pri, q931_call *c, int cause) |
| 2803 | 2827 | { |
| --- | --- | |
| 3018 | 3042 | case Q931_CONNECT: |
| 3019 | 3043 | case Q931_ALERTING: |
| 3020 | 3044 | case Q931_PROGRESS: |
| 3045 | c->useruserinfo[0] = '\0'; | |
| 3021 | 3046 | c->cause = -1; |
| 3022 | 3047 | case Q931_CALL_PROCEEDING: |
| 3023 | 3048 | c->progress = -1; |
| --- | --- | |
| 3037 | 3062 | if (c->retranstimer) |
| 3038 | 3063 | pri_schedule_del(pri, c->retranstimer); |
| 3039 | 3064 | c->retranstimer = 0; |
| 3065 | c->useruserinfo[0] = '\0'; | |
| 3040 | 3066 | break; |
| 3041 | 3067 | case Q931_RELEASE_COMPLETE: |
| 3042 | 3068 | if (c->retranstimer) |
| 3043 | 3069 | pri_schedule_del(pri, c->retranstimer); |
| 3044 | 3070 | c->retranstimer = 0; |
| 3071 | c->useruserinfo[0] = '\0'; | |
| 3045 | 3072 | case Q931_STATUS: |
| 3046 | 3073 | c->cause = -1; |
| 3047 | 3074 | c->causecode = -1; |
| --- | --- | |
| 3225 | 3252 | libpri_copy_string(pri->ev.ring.redirectingnum, c->redirectingnum, sizeof(pri->ev.ring.redirectingnum)); |
| 3226 | 3253 | libpri_copy_string(pri->ev.ring.redirectingname, c->redirectingname, sizeof(pri->ev.ring.redirectingname)); |
| 3227 | 3254 | libpri_copy_string(pri->ev.ring.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); |
| 3255 | c->useruserinfo[0] = '\0'; | |
| 3228 | 3256 | pri->ev.ring.redirectingreason = c->redirectingreason; |
| 3229 | 3257 | pri->ev.ring.origredirectingreason = c->origredirectingreason; |
| 3230 | 3258 | pri->ev.ring.flexible = ! (c->chanflags & FLAG_EXCLUSIVE); |
| --- | --- | |
| 3250 | 3278 | pri->ev.ringing.call = c; |
| 3251 | 3279 | pri->ev.ringing.progress = c->progress; |
| 3252 | 3280 | pri->ev.ringing.progressmask = c->progressmask; |
| 3281 | libpri_copy_string(pri->ev.ringing.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); | |
| 3282 | c->useruserinfo[0] = '\0'; | |
| 3253 | 3283 | return Q931_RES_HAVEEVENT; |
| 3254 | 3284 | case Q931_CONNECT: |
| 3255 | 3285 | if (c->newcall) { |
| --- | --- | |
| 3268 | 3298 | pri->ev.answer.call = c; |
| 3269 | 3299 | pri->ev.answer.progress = c->progress; |
| 3270 | 3300 | pri->ev.answer.progressmask = c->progressmask; |
| 3301 | libpri_copy_string(pri->ev.answer.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); | |
| 3302 | c->useruserinfo[0] = '\0'; | |
| 3271 | 3303 | q931_connect_acknowledge(pri, c); |
| 3272 | 3304 | if (c->justsignalling) { /* Make sure WE release when we initiatie a signalling only connection */ |
| 3273 | 3305 | q931_release(pri, c, PRI_CAUSE_NORMAL_CLEARING); |
| --- | --- | |
| 3381 | 3413 | pri->ev.hangup.cref = c->cr; |
| 3382 | 3414 | pri->ev.hangup.cause = c->cause; |
| 3383 | 3415 | pri->ev.hangup.call = c; |
| 3416 | libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); | |
| 3417 | c->useruserinfo[0] = '\0'; | |
| 3384 | 3418 | /* Free resources */ |
| 3385 | 3419 | if (c->alive) { |
| 3386 | 3420 | pri->ev.e = PRI_EVENT_HANGUP; |
| --- | --- | |
| 3414 | 3448 | pri->ev.hangup.cause = c->cause; |
| 3415 | 3449 | pri->ev.hangup.call = c; |
| 3416 | 3450 | pri->ev.hangup.aoc_units = c->aoc_units; |
| 3451 | libpri_copy_string(pri->ev.hangup.useruserinfo, c->useruserinfo, sizeof(pri->ev.ring.useruserinfo)); | |
| 3452 | c->useruserinfo[0] = '\0'; | |
| 3417 | 3453 | /* Don't send release complete if they send us release |
| 3418 | 3454 | while we sent it, assume a NULL state */ |
| 3419 | 3455 | if (c->newcall) |
![Home changeset 728 [home]](/images/logo.png?1180520111)

RSS Feeds