-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
261 lines (183 loc) · 41.4 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html><html lang="zh-Hans" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>hpng</title><meta name="description" content="卖掉梦想,不一定换来柴米油盐!"><meta name="author" content="hpng"><meta name="copyright" content="hpng"><meta name="format-detection" content="telephone=no"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://nikohpng.github.io/"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//fonts.googleapis.com" crossorigin="crossorigin"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="preconnect" href="//zz.bdstatic.com"/><meta property="og:type" content="website"><meta property="og:title" content="hpng"><meta property="og:url" content="http://nikohpng.github.io/"><meta property="og:site_name" content="hpng"><meta property="og:description" content="卖掉梦想,不一定换来柴米油盐!"><meta property="og:image" content="http://nikohpng.github.io/img/100.jpg"><meta property="article:published_time" content="2024-03-17T11:51:46.243Z"><meta property="article:modified_time" content="2024-03-17T11:51:46.243Z"><meta name="twitter:card" content="summary"><script>var activateDarkMode = function () {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#000')
}
}
var activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#fff')
}
}
var getCookies = function (name) {
const value = `; ${document.cookie}`
const parts = value.split(`; ${name}=`)
if (parts.length === 2) return parts.pop().split(';').shift()
}
var autoChangeMode = 'false'
var t = getCookies('theme')
if (autoChangeMode === '1') {
var isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
var isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
var isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
var hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
if (t === undefined) {
if (isLightMode) activateLightMode()
else if (isDarkMode) activateDarkMode()
else if (isNotSpecified || hasNoSupport) {
console.log('You specified no preference for a color scheme or your browser does not support it. I Schedule dark mode during night time.')
var now = new Date()
var hour = now.getHours()
var isNight = hour <= 6 || hour >= 18
isNight ? activateDarkMode() : activateLightMode()
}
window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
if (Cookies.get('theme') === undefined) {
e.matches ? activateDarkMode() : activateLightMode()
}
})
} else if (t === 'light') activateLightMode()
else activateDarkMode()
} else if (autoChangeMode === '2') {
now = new Date()
hour = now.getHours()
isNight = hour <= 6 || hour >= 18
if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
else if (t === 'light') activateLightMode()
else activateDarkMode()
} else {
if (t === 'dark') activateDarkMode()
else if (t === 'light') activateLightMode()
}</script><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Titillium+Web&display=swap"><script>var GLOBAL_CONFIG = {
root: '/',
hexoversion: '5.0.2',
algolia: undefined,
localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容:${query}"}},
translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
noticeOutdate: undefined,
copy: {
success: '复制成功',
error: '复制错误',
noSupport: '浏览器不支持'
},
bookmark: {
message_prev: '按',
message_next: '键将本页加入书签'
},
runtime_unit: '天',
runtime: false,
copyright: undefined,
ClickShowText: undefined,
medium_zoom: false,
fancybox: true,
Snackbar: undefined,
justifiedGallery: {
js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
},
baiduPush: true,
highlightCopy: true,
highlightLang: true,
isPhotoFigcaption: false,
islazyload: true,
isanchor: false
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = {
isPost: false,
isHome: true,
isHighlightShrink: false,
isSidebar: false,
postUpdate: '2024-03-17 19:51:46'
}</script><noscript><style>
#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
</style></noscript><meta name="generator" content="Hexo 5.0.2"><link rel="alternate" href="/atom.xml" title="hpng" type="application/atom+xml">
</head><body><div id="mobile-sidebar"><div id="menu_mask"></div><div id="mobile-sidebar-menus"><div class="mobile_author_icon"><img class="avatar-img" data-lazy-src="/img/100.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="mobile_post_data"><div class="mobile_data_item is-center"><div class="mobile_data_link"><a href="/archives/"><div class="headline">文章</div><div class="length_num">66</div></a></div></div><div class="mobile_data_item is-center"> <div class="mobile_data_link"><a href="/tags/"><div class="headline">标签</div><div class="length_num">51</div></a></div></div><div class="mobile_data_item is-center"> <div class="mobile_data_link"><a href="/categories/"><div class="headline">分类</div><div class="length_num">22</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/categories/Memory/"><i class="fa-fw fas fa-tags"></i><span> 记忆</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div></div></div></div><div id="body-wrap"><header class="full_page" id="page-header" style="background-image: url(/img/bg3.jpg)"><nav id="nav"><span class="pull-left" id="blog_name"><a class="blog_title" id="site-name" href="/">hpng</a></span><span class="pull-right menus"><div id="search_button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/categories/Memory/"><i class="fa-fw fas fa-tags"></i><span> 记忆</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 娱乐</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div></div><span class="toggle-menu close"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="site-info"><h1 id="site_title">hpng</h1><div id="site_subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="https://github.com/nikohpng" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll_down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout_page" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2024/03/17/memory/%E9%99%A4%E5%8D%B4%E5%B7%AB%E5%B1%B1%E4%B8%8D%E6%98%AF%E4%BA%91/" title="除却巫山不是云"> <img class="post_bg" data-lazy-src="/images/memory/family.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="除却巫山不是云"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/17/memory/%E9%99%A4%E5%8D%B4%E5%B7%AB%E5%B1%B1%E4%B8%8D%E6%98%AF%E4%BA%91/" title="除却巫山不是云">除却巫山不是云</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-03-17T11:43:32.000Z" title="发表于 2024-03-17 19:43:32">2024-03-17</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">离思
元稹
曾经沧海难为水,除却巫山不是云。
取次花丛懒回顾,半缘修道半缘君。
</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2024/03/14/memory/%E6%AC%B2%E5%BE%97%E5%91%A8%E9%83%8E%E9%A1%BE%E6%97%B6%E6%97%B6%E8%AF%AF%E6%8A%9A%E7%90%B4/" title="欲得周郎顾时时误抚琴"> <img class="post_bg" data-lazy-src="/images/memory/sakura.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="欲得周郎顾时时误抚琴"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/14/memory/%E6%AC%B2%E5%BE%97%E5%91%A8%E9%83%8E%E9%A1%BE%E6%97%B6%E6%97%B6%E8%AF%AF%E6%8A%9A%E7%90%B4/" title="欲得周郎顾时时误抚琴">欲得周郎顾时时误抚琴</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-03-14T12:06:44.000Z" title="发表于 2024-03-14 20:06:44">2024-03-14</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">国风·郑风·子衿
诗经
鸣筝金粟柱,素手玉房前。
欲得周郎顾,时时误拂弦。
</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2024/03/14/memory/%E7%BA%B5%E6%88%91%E4%B8%8D%E5%BE%80%E5%AD%90%E5%AE%81%E4%B8%8D%E5%97%A3%E9%9F%B3/" title="纵我不往子宁不嗣音"> <img class="post_bg" data-lazy-src="/images/memory/plum_blossom.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="纵我不往子宁不嗣音"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/03/14/memory/%E7%BA%B5%E6%88%91%E4%B8%8D%E5%BE%80%E5%AD%90%E5%AE%81%E4%B8%8D%E5%97%A3%E9%9F%B3/" title="纵我不往子宁不嗣音">纵我不往子宁不嗣音</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-03-14T11:57:26.000Z" title="发表于 2024-03-14 19:57:26">2024-03-14</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">国风·郑风·子衿
诗经
青青子衿,悠悠我心。纵我不往,子宁不嗣音?
青青子佩,悠悠我思。纵我不往,子宁不来?
挑兮达兮,在城阙兮。一日不见,如三月兮。
</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2024/02/25/memory/%E9%82%A3%E4%BA%BA%E5%8D%B4%E5%9C%A8%E7%81%AF%E7%81%AB%E9%98%91%E7%8F%8A%E5%A4%84/" title="那人却在灯火阑珊处"> <img class="post_bg" data-lazy-src="/images/memory/fireworks.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="那人却在灯火阑珊处"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/02/25/memory/%E9%82%A3%E4%BA%BA%E5%8D%B4%E5%9C%A8%E7%81%AF%E7%81%AB%E9%98%91%E7%8F%8A%E5%A4%84/" title="那人却在灯火阑珊处">那人却在灯火阑珊处</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-02-25T11:10:34.000Z" title="发表于 2024-02-25 19:10:34">2024-02-25</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">青玉案 元夕
辛弃疾
东风夜放花千树,更吹落,星如雨。
宝马雕车香满路。
凤箫声动,玉壶光转,一夜鱼龙舞。
蛾儿雪柳黄金缕,笑语盈盈暗香去。
众里寻他千百度,蓦然回首,那人却在,灯火阑珊处。
</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2024/02/24/memory/%E4%B8%BA%E4%BC%8A%E6%B6%88%E5%BE%97%E4%BA%BA%E6%86%94%E6%82%B4/" title="为伊消得人憔悴"> <img class="post_bg" data-lazy-src="/images/memory/haggard.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="为伊消得人憔悴"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/02/24/memory/%E4%B8%BA%E4%BC%8A%E6%B6%88%E5%BE%97%E4%BA%BA%E6%86%94%E6%82%B4/" title="为伊消得人憔悴">为伊消得人憔悴</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-02-24T11:28:11.000Z" title="发表于 2024-02-24 19:28:11">2024-02-24</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">蝶恋花
柳永
伫倚危楼风细细,望极春愁,黯黯生天际。草色烟光残照里,无言谁会凭阑意。
拟把疏狂图一醉,对酒当歌,强乐还无味。衣带渐宽终不悔,为伊消得人憔悴
</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2024/02/24/memory/%E5%BE%85%E5%88%B0%E5%B1%B1%E8%8A%B1%E7%83%82%E6%BC%AB%E6%97%B6/" title="待到山花烂漫时"> <img class="post_bg" data-lazy-src="/images/memory/bloom.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="待到山花烂漫时"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/02/24/memory/%E5%BE%85%E5%88%B0%E5%B1%B1%E8%8A%B1%E7%83%82%E6%BC%AB%E6%97%B6/" title="待到山花烂漫时">待到山花烂漫时</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-02-24T02:48:55.000Z" title="发表于 2024-02-24 10:48:55">2024-02-24</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/Memory/">Memory</a></span></div><div class="content">卜算子.咏梅
风雨送春归,飞雪迎春到。
已是悬崖百丈冰,犹有花枝俏。
俏也不争春,只把春来报。
待到山花烂漫时,她在丛中笑。
</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2024/01/01/freeswitch/%E9%98%85%E8%AF%BBSIP%E5%8D%8F%E8%AE%AE%E8%A7%82%E5%90%8E%E6%84%9F/" title="阅读SIP协议观后感"> <img class="post_bg" data-lazy-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="阅读SIP协议观后感"></a></div><div class="recent-post-info"><a class="article-title" href="/2024/01/01/freeswitch/%E9%98%85%E8%AF%BBSIP%E5%8D%8F%E8%AE%AE%E8%A7%82%E5%90%8E%E6%84%9F/" title="阅读SIP协议观后感">阅读SIP协议观后感</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2024-01-01T03:25:57.000Z" title="发表于 2024-01-01 11:25:57">2024-01-01</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/freeswitch/">freeswitch</a></span></div><div class="content">本文主要记录阅读 SIP rfc3261 文档的一些所思所考,不会对其进行整理分类,并且存在跳跃性
生成 SIP 响应
8.2.6
除了 invite 外需要生成临时响应,其它响应应该立即响应
生成的临时响应,请求中的时间戳应该直接复制到响应中。如果响应慢就需要将延迟时间以 s 为单位,将时间生成在响应中
响应的 Call-ID、CSeq、VIA的顺序必须相同。除了 100,其它响应的 uri 内容必须相同,并且需要添加一个 tag,用于 dialog。
事务的解读事务的分为客户端事务与服务器事务,客户端事务发送请求,服务器事务发送响应。
无状态代理不包含客户端事务或服务器事务。
200(Ok)的ack作用:主要为了确保 200ok 能够正常发送到 UAC。如果后续不发送 ACK,那么服务端会不断发送,并且在三分钟后断开连接
疑问:为啥 200 ok 的 ack 作为自己单独的事务?
解答:这样设计的原因是保证送达到UAC,并且如果没有回复 ACK,那么 UAS 将会重传
客户端事务:客户端事务的主要负责将接收到的响应传递给 TU, 并过滤重传与不允许的传递。对于 invite ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2023/12/24/freeswitch/Sip%E5%8D%8F%E8%AE%AE%E4%B8%AD%E7%9A%84%E4%B8%80%E4%BA%9B%E6%A6%82%E5%BF%B5/" title="Sip协议中的一些概念"> <img class="post_bg" data-lazy-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sip协议中的一些概念"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/12/24/freeswitch/Sip%E5%8D%8F%E8%AE%AE%E4%B8%AD%E7%9A%84%E4%B8%80%E4%BA%9B%E6%A6%82%E5%BF%B5/" title="Sip协议中的一些概念">Sip协议中的一些概念</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-12-24T03:13:54.000Z" title="发表于 2023-12-24 11:13:54">2023-12-24</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/freeswitch/">freeswitch</a></span></div><div class="content">本文主要介绍 SIP 协议中的一些缩写字符的含义,这些缩写在阅读 Sofia-sip 的代码时常有出现
Sip 缩写字符
线性空白(Linear White Space,简称LWS): 位于文本字符序列中的空白字符,包括空格、制表符和换行符等。在计算机编程中,线性空白通常用来描述文本中字符之间的间距,包括但不限于字母、数字、标点符号等。线性空白与非线性空白(Non-Linear White Space,简称NLWS)相对,非线性空白一般指符号或标点之间的间距,如句子结束的标点符号与下一句的起始字母之间的间隔
CRLF: 换行符
</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/2023/12/23/freeswitch/Sofia%E4%B8%AD%E7%9A%84%E4%B8%80%E4%BA%9B%E6%A6%82%E5%BF%B5/" title="Sofia中的一些概念"> <img class="post_bg" data-lazy-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sofia中的一些概念"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/12/23/freeswitch/Sofia%E4%B8%AD%E7%9A%84%E4%B8%80%E4%BA%9B%E6%A6%82%E5%BF%B5/" title="Sofia中的一些概念">Sofia中的一些概念</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-12-23T13:36:32.000Z" title="发表于 2023-12-23 21:36:32">2023-12-23</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/freeswitch/">freeswitch</a></span></div><div class="content">本文主要对 Sofia 中的一些概念进行分析与解释,方便进行源码阅读。
Sofia 概念事件循环Event loop 与根对象 root object
NUA以事件反应器模式(也称为分发及通知模式)驱动事件系统(请参考[Using Design Patterns to Develop Reusable Object-oriented Communication Software, D.C. Schmidt, CACM October ‘95, 38(10): 65-74]一书)。Sofia以任务作为编程模型的基本执行单元。根据编程模型,程序可以请求事件循环在特定事件触发时调用回调函数。具体事件包括I/O激活,定时器或其它任务传递的异步消息。
root 对象是应用软件中描述一个任务的句柄。
透视事件的另一种方式是:root对象描述任务的主事件循环。通过root对象,任务代码可以访问它的上下文信息(magic)和线程同步,比如说等待对象、定时器,消息。
使用NUA服务的应用必须创建一个root对象,并设置处理NUA事件的回调函数。
调用 su_root_create()创建root对象 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/2023/12/23/freeswitch/Sofia%E5%8F%91%E9%80%81subscriber%E7%9A%84%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/" title="Sofia发送subscriber的源码解析"> <img class="post_bg" data-lazy-src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sofia发送subscriber的源码解析"></a></div><div class="recent-post-info"><a class="article-title" href="/2023/12/23/freeswitch/Sofia%E5%8F%91%E9%80%81subscriber%E7%9A%84%E6%BA%90%E7%A0%81%E8%A7%A3%E6%9E%90/" title="Sofia发送subscriber的源码解析">Sofia发送subscriber的源码解析</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-12-23T12:48:25.000Z" title="发表于 2023-12-23 20:48:25">2023-12-23</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox article-meta__icon"></i><a class="article-meta__categories" href="/categories/freeswitch/">freeswitch</a></span></div><div class="content">本文将对 sofia 发送 subscriber 这个信令进行源码分析其中会对一些涉及到的其它源码进行解析,用以后续学习
Sofia 的 handle这里对 handle 进行一定的解释。这个 handle 用于管理向谁发送什么样的数据,这个谁一般指定 uac 。 一个 handle 会生成一个新的 call-id,产生一个新的 session。
nua_handle_destroy(): 用于销毁这个 handle。
小知识:FreeSWITCH 一般在创建后 nua_handle_bind(fnh, &mod_sofia_globals.destroy_private),后续不用后会自动销毁, 这个销毁主要依赖于 our_sofia_event_callback中的以下代码:12345if ((sofia_private && sofia_private == &mod_sofia_globals.destroy_private)) { nua_handle_bind(nh, NULL); nua_handle ...</div></div></div><nav id="pagination"><div class="pagination"><span class="page-number current">1</span><a class="page-number" href="/page/2/">2</a><span class="space">…</span><a class="page-number" href="/page/7/">7</a><a class="extend next" rel="next" href="/page/2/"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" data-lazy-src="/img/100.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">hpng</div><div class="author-info__description">卖掉梦想,不一定换来柴米油盐!</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives"><div class="headline">文章</div><div class="length_num">66</div></a></div><div class="card-info-data-item is-center"> <a href="/tags"><div class="headline">标签</div><div class="length_num">51</div></a></div><div class="card-info-data-item is-center"><a href="/categories"><div class="headline">分类</div><div class="length_num">22</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/nikohpng"><i class="fab fa-github"></i><span>查看我</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/nikohpng" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">blog主要用于分享我在生活与工作中学习到的知识</div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-recent-item"><div class="aside-recent-post"><a class="aside-post-cover" href="/2024/03/17/memory/%E9%99%A4%E5%8D%B4%E5%B7%AB%E5%B1%B1%E4%B8%8D%E6%98%AF%E4%BA%91/" title="除却巫山不是云"><img class="aside-post-bg" data-lazy-src="/images/memory/family.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="除却巫山不是云"/></a><div class="aside-post-info"><a class="aside-post-title" href="/2024/03/17/memory/%E9%99%A4%E5%8D%B4%E5%B7%AB%E5%B1%B1%E4%B8%8D%E6%98%AF%E4%BA%91/" title="除却巫山不是云">除却巫山不是云</a><time class="aside-post_meta post-meta-date" datetime="2024-03-17T11:43:32.000Z" title="发表于 2024-03-17 19:43:32">2024-03-17</time></div></div><div class="aside-recent-post"><a class="aside-post-cover" href="/2024/03/14/memory/%E6%AC%B2%E5%BE%97%E5%91%A8%E9%83%8E%E9%A1%BE%E6%97%B6%E6%97%B6%E8%AF%AF%E6%8A%9A%E7%90%B4/" title="欲得周郎顾时时误抚琴"><img class="aside-post-bg" data-lazy-src="/images/memory/sakura.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="欲得周郎顾时时误抚琴"/></a><div class="aside-post-info"><a class="aside-post-title" href="/2024/03/14/memory/%E6%AC%B2%E5%BE%97%E5%91%A8%E9%83%8E%E9%A1%BE%E6%97%B6%E6%97%B6%E8%AF%AF%E6%8A%9A%E7%90%B4/" title="欲得周郎顾时时误抚琴">欲得周郎顾时时误抚琴</a><time class="aside-post_meta post-meta-date" datetime="2024-03-14T12:06:44.000Z" title="发表于 2024-03-14 20:06:44">2024-03-14</time></div></div><div class="aside-recent-post"><a class="aside-post-cover" href="/2024/03/14/memory/%E7%BA%B5%E6%88%91%E4%B8%8D%E5%BE%80%E5%AD%90%E5%AE%81%E4%B8%8D%E5%97%A3%E9%9F%B3/" title="纵我不往子宁不嗣音"><img class="aside-post-bg" data-lazy-src="/images/memory/plum_blossom.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="纵我不往子宁不嗣音"/></a><div class="aside-post-info"><a class="aside-post-title" href="/2024/03/14/memory/%E7%BA%B5%E6%88%91%E4%B8%8D%E5%BE%80%E5%AD%90%E5%AE%81%E4%B8%8D%E5%97%A3%E9%9F%B3/" title="纵我不往子宁不嗣音">纵我不往子宁不嗣音</a><time class="aside-post_meta post-meta-date" datetime="2024-03-14T11:57:26.000Z" title="发表于 2024-03-14 19:57:26">2024-03-14</time></div></div><div class="aside-recent-post"><a class="aside-post-cover" href="/2024/02/25/memory/%E9%82%A3%E4%BA%BA%E5%8D%B4%E5%9C%A8%E7%81%AF%E7%81%AB%E9%98%91%E7%8F%8A%E5%A4%84/" title="那人却在灯火阑珊处"><img class="aside-post-bg" data-lazy-src="/images/memory/fireworks.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="那人却在灯火阑珊处"/></a><div class="aside-post-info"><a class="aside-post-title" href="/2024/02/25/memory/%E9%82%A3%E4%BA%BA%E5%8D%B4%E5%9C%A8%E7%81%AF%E7%81%AB%E9%98%91%E7%8F%8A%E5%A4%84/" title="那人却在灯火阑珊处">那人却在灯火阑珊处</a><time class="aside-post_meta post-meta-date" datetime="2024-02-25T11:10:34.000Z" title="发表于 2024-02-25 19:10:34">2024-02-25</time></div></div><div class="aside-recent-post"><a class="aside-post-cover" href="/2024/02/24/memory/%E4%B8%BA%E4%BC%8A%E6%B6%88%E5%BE%97%E4%BA%BA%E6%86%94%E6%82%B4/" title="为伊消得人憔悴"><img class="aside-post-bg" data-lazy-src="/images/memory/haggard.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="为伊消得人憔悴"/></a><div class="aside-post-info"><a class="aside-post-title" href="/2024/02/24/memory/%E4%B8%BA%E4%BC%8A%E6%B6%88%E5%BE%97%E4%BA%BA%E6%86%94%E6%82%B4/" title="为伊消得人憔悴">为伊消得人憔悴</a><time class="aside-post_meta post-meta-date" datetime="2024-02-24T11:28:11.000Z" title="发表于 2024-02-24 19:28:11">2024-02-24</time></div></div></div></div></div><div class="card-widget card-categories"><div class="card-content"><div class="item-headline"><i class="fas fa-folder-open"></i><span>分类</span></div><ul class="card-category-list">
<li class="card-category-list-item "><a class="card-category-list-link" href="/categories/ES6/"><span class="card-category-list-name">ES6</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/FFmpeg/"><span class="card-category-list-name">FFmpeg</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/FreeSWTICH/"><span class="card-category-list-name">FreeSWTICH</span><span class="card-category-list-count">9</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Memory/"><span class="card-category-list-name">Memory</span><span class="card-category-list-count">6</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Shell/"><span class="card-category-list-name">Shell</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/WebRTC/"><span class="card-category-list-name">WebRTC</span><span class="card-category-list-count">6</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/c/"><span class="card-category-list-name">c</span><span class="card-category-list-count">15</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/capture/"><span class="card-category-list-name">capture</span><span class="card-category-list-count">1</span></a></li>
<li class="card-category-list-item more is-center"><a class="card-category-list-link-more" href="/categories">
<span>查看更多</span><i class="fas fa-angle-right"></i></a></li>
</ul></div></div><div class="card-widget card-tags"><div class="card-content"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href='/tags/FreeSWITCH%E6%BA%90%E7%A0%81/' style='font-size:17px; color:rgb(191, 163, 42)'>FreeSWITCH源码</a><a href='/tags/IO/' style='font-size:21px; color:rgb(30, 156, 64)'>IO</a><a href='/tags/PowerShell/' style='font-size:21px; color:rgb(8, 158, 102)'>PowerShell</a><a href='/tags/Question/' style='font-size:16px; color:rgb(173, 80, 40)'>Question</a><a href='/tags/Sip/' style='font-size:19px; color:rgb(20, 63, 70)'>Sip</a><a href='/tags/Sofia/' style='font-size:21px; color:rgb(74, 85, 97)'>Sofia</a><a href='/tags/Source/' style='font-size:19px; color:rgb(2, 151, 73)'>Source</a><a href='/tags/WebRTC%E7%BC%96%E8%AF%91/' style='font-size:21px; color:rgb(35, 132, 115)'>WebRTC编译</a><a href='/tags/attribute/' style='font-size:21px; color:rgb(59, 114, 122)'>attribute</a><a href='/tags/bash/' style='font-size:19px; color:rgb(178, 142, 145)'>bash</a><a href='/tags/c-release/' style='font-size:20px; color:rgb(187, 197, 153)'>c_release</a><a href='/tags/channels/' style='font-size:19px; color:rgb(118, 21, 160)'>channels</a><a href='/tags/cmake/' style='font-size:18px; color:rgb(39, 197, 78)'>cmake</a><a href='/tags/command/' style='font-size:18px; color:rgb(167, 53, 11)'>command</a><a href='/tags/demo/' style='font-size:16px; color:rgb(104, 159, 6)'>demo</a><a href='/tags/eureka/' style='font-size:17px; color:rgb(106, 145, 26)'>eureka</a><a href='/tags/event/' style='font-size:21px; color:rgb(154, 197, 85)'>event</a><a href='/tags/fork/' style='font-size:17px; color:rgb(81, 79, 18)'>fork</a><a href='/tags/hexo/' style='font-size:20px; color:rgb(167, 134, 149)'>hexo</a><a href='/tags/hz/' style='font-size:20px; color:rgb(171, 70, 178)'>hz</a><a href='/tags/janus-admin/' style='font-size:21px; color:rgb(197, 185, 179)'>janus-admin</a><a href='/tags/log/' style='font-size:21px; color:rgb(128, 163, 165)'>log</a><a href='/tags/make/' style='font-size:18px; color:rgb(158, 47, 90)'>make</a><a href='/tags/maven/' style='font-size:18px; color:rgb(180, 67, 76)'>maven</a><a href='/tags/mod/' style='font-size:18px; color:rgb(120, 192, 46)'>mod</a><a href='/tags/mybatis/' style='font-size:18px; color:rgb(74, 40, 94)'>mybatis</a><a href='/tags/opus/' style='font-size:18px; color:rgb(68, 121, 175)'>opus</a><a href='/tags/opus%E3%80%81h264/' style='font-size:16px; color:rgb(197, 139, 61)'>opus、h264</a><a href='/tags/pom/' style='font-size:19px; color:rgb(17, 175, 134)'>pom</a><a href='/tags/signal/' style='font-size:18px; color:rgb(34, 174, 150)'>signal</a><a href='/tags/sip/' style='font-size:17px; color:rgb(140, 144, 66)'>sip</a><a href='/tags/socket/' style='font-size:16px; color:rgb(43, 167, 8)'>socket</a><a href='/tags/spring-boot%E6%BA%90%E7%A0%81/' style='font-size:16px; color:rgb(105, 76, 110)'>spring boot源码</a><a href='/tags/springcloud/' style='font-size:16px; color:rgb(95, 55, 116)'>springcloud</a><a href='/tags/tomcat/' style='font-size:21px; color:rgb(200, 165, 52)'>tomcat</a><a href='/tags/win/' style='font-size:21px; color:rgb(161, 98, 132)'>win</a><a href='/tags/xml-rpc/' style='font-size:20px; color:rgb(70, 125, 15)'>xml_rpc</a><a href='/tags/%E4%BD%8D%E8%BF%90%E7%AE%97/' style='font-size:19px; color:rgb(190, 176, 103)'>位运算</a><a href='/tags/%E4%BE%9D%E8%B5%96/' style='font-size:18px; color:rgb(84, 15, 103)'>依赖</a><a href='/tags/%E5%85%B3%E9%94%AE%E5%AD%97/' style='font-size:20px; color:rgb(50, 63, 109)'>关键字</a></div></div></div><div class="card-widget card-archives"><div class="card-content"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/03/"><span class="card-archive-list-date">March 2024</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/02/"><span class="card-archive-list-date">February 2024</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/01/"><span class="card-archive-list-date">January 2024</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/12/"><span class="card-archive-list-date">December 2023</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/07/"><span class="card-archive-list-date">July 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/06/"><span class="card-archive-list-date">June 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/04/"><span class="card-archive-list-date">April 2023</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/03/"><span class="card-archive-list-date">March 2023</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item more is-center"><a class="card-archive-list-link-more" href="/archives">
<span>查看更多</span><i class="fas fa-angle-right" ></i></a></li></ul></div></div><div class="card-widget card-webinfo"><div class="card-content"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="webinfo-article-name">文章数目 :</div><div class="webinfo-article-count">66</div></div><div class="webinfo-item"> <div class="webinfo-site-uv-name">本站访客数 :</div><div class="webinfo-site-uv-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="webinfo-site-name">本站总访问量 :</div><div class="webinfo-site-pv-count" id="busuanzi_value_site_pv"></div></div></div></div></div></div></main><footer id="footer" data-type="color"><div id="footer-wrap"><div class="copyright">©2020 - 2024 By hpng</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a><br>
<img src="https://www.hepng.cool/images/beian.png">
<a href="http://beian.miit.gov.cn/" style="color:#f72b07" target="_blank">蜀ICP备20025047号</a></div></div></footer></div><section id="rightside"><div id="rightside-config-hide"><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></section><div class="search-dialog" id="local-search"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"><div id="local-hits"></div><div id="local-stats"><div class="local-search-stats__hr" id="hr"><span>Powered by</span> <a target="_blank" rel="noopener" href="https://github.com/wzpan/hexo-generator-search" style="color:#49B1F5;">hexo-generator-search</a></div></div></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js" async></script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>function subtitleType () {
$.getJSON('https://v1.hitokoto.cn', function (data) {
if (false) {
var from = '出自 ' + data.from
var sub = "".length == 0 ? new Array() : "".split(',')
var both = sub.unshift(data.hitokoto, from)
var typed = new Typed('#subtitle', {
strings: sub,
startDelay: 300,
typeSpeed: 150,
loop: true,
backSpeed: 50,
})
} else {
document.getElementById('subtitle').innerHTML = data.hitokoto
}
})
}
if (false) {
if (typeof Typed === 'function') subtitleType()
else $.getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js', subtitleType)
} else {
subtitleType()
}
</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></div></body></html>