Data-Over-Voice
[lcr.git] / ie.cpp
diff --git a/ie.cpp b/ie.cpp
index 933287e..7509440 100644 (file)
--- a/ie.cpp
+++ b/ie.cpp
@@ -616,7 +616,7 @@ void Pdss1::enc_ie_cause(struct l3_msg *l3m, int location, int cause)
        unsigned char p[256];
        int l;
 
-       if (location<0 || location>7) {
+       if (location<0 || location>10) {
                PERROR("location(%d) is out of range.\n", location);
                return;
        }
@@ -711,13 +711,15 @@ void Pdss1::enc_ie_channel_id(struct l3_msg *l3m, int exclusive, int channel)
                add_layer3_ie(l3m, p[0], p[1], p+2);
        } else {
                /* PRI */
-               if (channel == CHANNEL_NO) /* no channel */
-                       return; /* IE not present */
-               if (channel == CHANNEL_ANY) /* any channel */ {
+               if (channel == CHANNEL_NO || channel == CHANNEL_ANY) {
+                       if (channel == CHANNEL_NO)
+                               channel = 0;
+                       else
+                               channel = 3;
                        l = 1;
                        p[0] = IE_CHANNEL_ID;
                        p[1] = l;
-                       p[2] = 0x80 + 0x20 + 0x03;
+                       p[2] = 0x80 + 0x20 + channel;
                        add_layer3_ie(l3m, p[0], p[1], p+2);
                        return; /* end */
                }
@@ -1096,7 +1098,7 @@ void Pdss1::dec_ie_redir_nr(struct l3_msg *l3m, int *type, int *plan, int *prese
        *reason = -1;
        *number = '\0';
 
-       unsigned char *p = l3m->redirect_nr;
+       unsigned char *p = l3m->redirecting_nr;
        if (!p)
                return;
        if (p[0] < 1) {
@@ -1179,7 +1181,7 @@ void Pdss1::dec_ie_redir_dn(struct l3_msg *l3m, int *type, int *plan, int *prese
        *present = -1;
        *number = '\0';
 
-       unsigned char *p = l3m->redirect_dn;
+       unsigned char *p = l3m->redirection_nr;
        if (!p)
                return;
        if (p[0] < 1) {