From cfee7ff0074b16e00dfbfbfc9990cb9a78b0ac0a Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Tue, 13 Sep 2005 02:19:00 +0000 Subject: [PATCH] Add ability to restart PRI at Q.921 layer git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@247 2fbb986a-6c06-0410-b554-c9c1f0a7f128 --- libpri.h | 3 +++ pri.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/libpri.h b/libpri.h index 878a3f2..f4ef1eb 100755 --- a/libpri.h +++ b/libpri.h @@ -487,6 +487,9 @@ extern int pri_hangup(struct pri *pri, q931_call *call, int cause); #define PRI_DESTROYCALL extern void pri_destroycall(struct pri *pri, q931_call *call); +#define PRI_RESTART +extern int pri_restart(struct pri *pri); + extern int pri_reset(struct pri *pri, int channel); /* Create a new call */ diff --git a/pri.c b/pri.c index 0493dac..64fe5f8 100755 --- a/pri.c +++ b/pri.c @@ -247,6 +247,16 @@ static struct pri *__pri_new(int fd, int node, int switchtype, struct pri *maste return p; } +int pri_restart(struct pri *pri) +{ + /* Restart Q.921 layer */ + if (pri) { + q921_reset(pri); + q921_start(pri, pri->localtype == PRI_CPE); + } + return 0; +} + struct pri *pri_new(int fd, int nodetype, int switchtype) { return __pri_new(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL);