Review Board 1.7.16


Add a name to a sig_pri span

Review Request #800 - Created July 25, 2010 and updated

Tzafrir Cohen
/trunk
Reviewers
asterisk-dev
rmudgett
Asterisk
sig_pri of chan_dahdi gives annoying messages such as:

[Jul 25 20:58:14] WARNING[2289]: sig_pri.c:985 pri_find_dchan: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2290]: sig_pri.c:985 pri_find_dchan: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2287]: sig_pri.c:985 pri_find_dchan: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2288]: sig_pri.c:985 pri_find_dchan: No D-channels available.  Using Primary channel as D-channel anyway.

This change is intended to transform them to equally annoying and yet slightly more meaningful messages:
 
[Jul 25 20:58:14] WARNING[2289]: sig_pri.c:985 pri_find_dchan: Span DAHDI/3: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2290]: sig_pri.c:985 pri_find_dchan: Span DAHDI/4: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2287]: sig_pri.c:985 pri_find_dchan: Span DAHDI/1: No D-channels available.  Using Primary channel as D-channel anyway.
[Jul 25 20:58:14] WARNING[2288]: sig_pri.c:985 pri_find_dchan: Span DAHDI/2: No D-channels available.  Using Primary channel as D-channel anyway.

As for the original issue, see https://issues.asterisk.org/view.php?id=17270 .

This fix adds a field called 'name' to the struct sig_pri_span, and uses it when displaying span information, and also in that specific message as a demonstration.

Note that the code in chan_dahdi.c:mkintf() at that point could use some indentation-level reduction as well at the same spot.
Lightly tested loading, unloading and such.

Changes between revision 1 and 2

1 2
1 2

  1. /trunk/channels/chan_dahdi.c: Loading...
  2. /trunk/channels/sig_pri.h: Loading...
  3. /trunk/channels/sig_pri.c: Loading...
/trunk/channels/chan_dahdi.c
Diff Revision 1 Diff Revision 2
[20] 1822 lines
[+20] [+] static int my_distinctive_ring(struct ast_channel *chan, void *pvt, int idx, int *ringdata)
1823
				}
1823
				}
1824
			}
1824
			}
1825

    
   
1825

   
1826
			if (distMatches == 3) {
1826
			if (distMatches == 3) {
1827
				/* The ring matches, set the context to whatever is for distinctive ring.. */
1827
				/* The ring matches, set the context to whatever is for distinctive ring.. */
1828
				ast_copy_string(p->context, p->drings.ringContext[counter].contextData, sizeof(p->context));
1828
				ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
1829
				ast_copy_string(chan->context, p->drings.ringContext[counter].contextData, sizeof(chan->context));
1829
				ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
1830
				ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
1830
				ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
1831
				break;
1831
				break;
1832
			}
1832
			}
1833
		}
1833
		}
1834
	}
1834
	}
[+20] [20] 8372 lines
[+20] [+] static void *analog_ss_thread(void *data)
10207
								}
10207
								}
10208
							}
10208
							}
10209

    
   
10209

   
10210
							if (distMatches == 3) {
10210
							if (distMatches == 3) {
10211
								/* The ring matches, set the context to whatever is for distinctive ring.. */
10211
								/* The ring matches, set the context to whatever is for distinctive ring.. */
10212
								ast_copy_string(p->context, p->drings.ringContext[counter].contextData, sizeof(p->context));
10212
								ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
10213
								ast_copy_string(chan->context, p->drings.ringContext[counter].contextData, sizeof(chan->context));
10213
								ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
10214
								ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
10214
								ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
10215
								break;
10215
								break;
10216
							}
10216
							}
10217
						}
10217
						}
10218
					}
10218
					}
[+20] [20] 226 lines
[+20] static void *analog_ss_thread(void *data)
10445
									distMatches++;
10445
									distMatches++;
10446
								}
10446
								}
10447
							}
10447
							}
10448
							if (distMatches == 3) {
10448
							if (distMatches == 3) {
10449
								/* The ring matches, set the context to whatever is for distinctive ring.. */
10449
								/* The ring matches, set the context to whatever is for distinctive ring.. */
10450
								ast_copy_string(p->context, p->drings.ringContext[counter].contextData, sizeof(p->context));
10450
								ast_copy_string(p->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(p->context));
10451
								ast_copy_string(chan->context, p->drings.ringContext[counter].contextData, sizeof(chan->context));
10451
								ast_copy_string(chan->context, S_OR(p->drings.ringContext[counter].contextData, p->defcontext), sizeof(chan->context));
10452
								ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
10452
								ast_verb(3, "Distinctive Ring matched context %s\n",p->context);
10453
								break;
10453
								break;
10454
							}
10454
							}
10455
						}
10455
						}
10456
					}
10456
					}
[+20] [20] 7481 lines
/trunk/channels/sig_pri.h
Diff Revision 1 Diff Revision 2
 
/trunk/channels/sig_pri.c
Diff Revision 1 Diff Revision 2
 
  1. /trunk/channels/chan_dahdi.c: Loading...
  2. /trunk/channels/sig_pri.h: Loading...
  3. /trunk/channels/sig_pri.c: Loading...

https://reviewboard.asterisk.org/ runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to asteriskteam@digium.com.